feat: further reduction in complexity

#5
This commit is contained in:
silver 2023-07-30 22:20:15 +01:00
parent bf1d91e110
commit 344d958aec

View file

@ -49,7 +49,7 @@ pub async fn post_update_ldap(mut req: Request<State>) -> tide::Result {
}
// check if the password field itself is being updated
let (pass_old, pass_new) = if &field != "userPassword" {
let pass_new = if &field != "userPassword" {
// if password is not being updated then just update the required field
let mods = vec![
// the value we are updating
@ -60,11 +60,11 @@ pub async fn post_update_ldap(mut req: Request<State>) -> tide::Result {
// pass back the "old" and "new" passwords
// using this means we can create teh vars without them needing to be mutable
(pass.clone(), pass.clone())
pass.clone()
} else {
// password is going to be updated, even if the old value is not starting with "{SSHA512}"
pw_keep_same = false;
(pass.clone(), value)
value
};
// changing teh password because of an explicit request or upgrading teh security.
@ -73,7 +73,7 @@ pub async fn post_update_ldap(mut req: Request<State>) -> tide::Result {
let tmp = PasswordModify {
// none as we are staying on the same connection
user_id: None,
old_pass: Some(&pass_old),
old_pass: Some(&pass),
new_pass: Some(&pass_new),
};