actually allow username-only accounts to change password
This commit is contained in:
parent
3083fb17d9
commit
8291f36660
|
|
@ -17,6 +17,7 @@ use crate::{
|
|||
state_input::{InputType, StateInput},
|
||||
},
|
||||
pages::mainpage::SignedOutMainPage,
|
||||
storage::{LoginState, StorageKey},
|
||||
};
|
||||
|
||||
#[function_component]
|
||||
|
|
@ -35,7 +36,17 @@ pub fn UserSettingsPage() -> Html {
|
|||
<ErrorDisplay state={error_state.clone()}/>
|
||||
};
|
||||
|
||||
let current_password_state = use_state(String::new);
|
||||
let current_password_state = {
|
||||
let current_password = if let Ok(LoginState::Passwordless { password, .. }) =
|
||||
LoginState::load_from_storage()
|
||||
{
|
||||
password.to_string()
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
|
||||
use_state(|| current_password)
|
||||
};
|
||||
let new_password_state = use_state(String::new);
|
||||
let new_password_repeat_state = use_state(String::new);
|
||||
let change_password = {
|
||||
|
|
@ -98,6 +109,9 @@ pub fn UserSettingsPage() -> Html {
|
|||
return;
|
||||
};
|
||||
let on_success = {
|
||||
if let Err(err) = LoginState::NoLogin.save_to_storage() {
|
||||
log::error!("saving NoLogin storage state: {err}");
|
||||
}
|
||||
let change_password_modal_id = change_password_modal_id.clone();
|
||||
Callback::from(move |_| {
|
||||
if let Some(dialog) = gloo::utils::document()
|
||||
|
|
|
|||
Loading…
Reference in New Issue