M Cargo.lock => Cargo.lock +2 -3
@@ 3469,9 3469,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.7.1"
+version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
+checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a"
dependencies = [
"aho-corasick",
"memchr",
@@ 3659,7 3659,6 @@ dependencies = [
"futures-lite",
"iyes_loopless",
"proc-macro2",
- "regex",
"reqwest",
"serde",
"serde_json",
M sdbclient/Cargo.toml => sdbclient/Cargo.toml +0 -3
@@ 48,6 48,3 @@ futures-lite = "1.12.0"
# get dirs for saving data
directories = "4.0.1"
-
-# regex
-regex = "1.7.1"
M => +7 -2
@@ 1,6 1,6 @@
/*
* This file is part of sdbclient
* Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
* Copyright (C) 2022 Jonni Liljamo <jonni@liljamo.com>
*
* Licensed under GPL-3.0-only.
* See LICENSE for licensing information.
@@ 35,7 35,12 @@ impl Plugin for AccountLoginPlugin {
app.add_loopless_state(LoginState::None)
// UI system
.insert_resource(ui::InputsUserLogin::new())
.add_enter_system(LoginState::Input, ui::account_login_setup)
.add_system_set(
ConditionSet::new()
.run_in_state(LoginState::Input)
.with_system(ui::account_login_ui)
.into(),
)
// Login system, as in calling the API
.add_enter_system(LoginState::LoggingIn, start_login_call)
.add_system_set(
M => +4 -44
@@ 1,17 1,16 @@
/*
* This file is part of sdbclient
* Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
* Copyright (C) 2022 Jonni Liljamo <jonni@liljamo.com>
*
* Licensed under GPL-3.0-only.
* See LICENSE for licensing information.
*/
use bevy::prelude::*;
use bevy_inspector_egui::bevy_egui::{egui, EguiContext};
use iyes_loopless::prelude::*;
use belly::prelude::*;
use regex::Regex;
use crate::util::eguipwd;
use crate::plugins::menu::MenuState;
@@ 19,10 18,9 @@ use super::LoginState;
/// Login inputs
#[derive(Resource, Debug, Component, PartialEq, Eq, Clone)]
pub(super) struct InputsUserLogin {
pub struct InputsUserLogin {
pub email: String,
pub password: String,
pub visible_pwd: String,
pub error: String,
}
@@ 31,48 29,11 @@ impl InputsUserLogin {
Self {
email: "".to_string(),
password: "".to_string(),
visible_pwd: "".to_string(),
error: "".to_string(),
}
}
}
pub(super) fn account_login_setup(mut commands: Commands /*, pwd: Res<Password>*/) {
let input_email = commands.spawn_empty().id();
let input_password = commands.spawn_empty().id();
//let visible_pwd = pwd.visible.clone();
commands.add(eml! {
<body>
<div c:menu>
<span c:menutitle>
"Login"
</span>
<span>"Email:"</span>
<textinput {input_email} bind:value=to!(input_email, Label:value | fmt.val("{val}"))/>
<span>"Password:"</span>
<textinput {input_password} bind:value=from!(InputsUserLogin:password | fmt.s("{s}"))/>
<button c:menubutton on:press=connect!(|ctx| {
//ctx.commands().insert_resource(NextState(LoginState::LoggingIn))
})>
"Login"
</button>
<button c:menubutton on:press=connect!(|ctx| {
ctx.commands().insert_resource(NextState(LoginState::None));
ctx.commands().insert_resource(NextState(MenuState::AccountLoggedOut));
})>
"Cancel"
</button>
</div>
</body>
});
}
/*
pub fn account_login_ui(
mut commands: Commands,
mut egui_context: ResMut<EguiContext>,
@@ 111,4 72,3 @@ pub fn account_login_ui(
})
});
}
*/
M => +1 -2
@@ 53,8 53,7 @@ impl Plugin for MenuPlugin {
.add_enter_system(MenuState::Settings, settings_setup)
.add_exit_system(MenuState::Settings, remove_ui)
// Systems for account loggedout screen
.add_enter_system(MenuState::AccountLoggedOut, remove_ui.label("account_logged_out_enter_remove_ui"))
.add_enter_system(MenuState::AccountLoggedOut, account_loggedout_setup.after("account_logged_out_enter_remove_ui"))
.add_enter_system(MenuState::AccountLoggedOut, account_loggedout_setup)
.add_exit_system(MenuState::AccountLoggedOut, remove_ui)
// Systems for account loggedin screen
.add_enter_system(MenuState::AccountLoggedIn, account_loggedin_setup)