From 344d958aec4ba2750713f76e63d310e83e040584 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Sun, 30 Jul 2023 22:20:15 +0100 Subject: [PATCH] feat: further reduction in complexity #5 --- src/methods/account_update.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/methods/account_update.rs b/src/methods/account_update.rs index db2b19d..9dd0f27 100644 --- a/src/methods/account_update.rs +++ b/src/methods/account_update.rs @@ -49,7 +49,7 @@ pub async fn post_update_ldap(mut req: Request) -> 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) -> 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) -> 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), };