From 8596c54d6aef7676e838125b4386ec7cb6df0f80 Mon Sep 17 00:00:00 2001 From: Katharina Drexel Date: Tue, 2 Aug 2022 14:24:00 +0200 Subject: [PATCH] Fixing query order (otherwise you run into app_key exception before anonymous ldap applied). Signed-off-by: Katharina Drexel --- app/Models/Ldap.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Models/Ldap.php b/app/Models/Ldap.php index 907238ce41..4c47147625 100644 --- a/app/Models/Ldap.php +++ b/app/Models/Ldap.php @@ -169,14 +169,14 @@ class Ldap extends Model { $ldap_username = Setting::getSettings()->ldap_uname; - // Lets return some nicer messages for users who donked their app key, and disable LDAP - try { - $ldap_pass = \Crypt::decrypt(Setting::getSettings()->ldap_pword); - } catch (Exception $e) { - throw new Exception('Your app key has changed! Could not decrypt LDAP password using your current app key, so LDAP authentication has been disabled. Login with a local account, update the LDAP password and re-enable it in Admin > Settings.'); - } - if ( $ldap_username ) { + // Lets return some nicer messages for users who donked their app key, and disable LDAP + try { + $ldap_pass = \Crypt::decrypt(Setting::getSettings()->ldap_pword); + } catch (Exception $e) { + throw new Exception('Your app key has changed! Could not decrypt LDAP password using your current app key, so LDAP authentication has been disabled. Login with a local account, update the LDAP password and re-enable it in Admin > Settings.'); + } + if (! $ldapbind = @ldap_bind($connection, $ldap_username, $ldap_pass)) { throw new Exception('Could not bind to LDAP: '.ldap_error($connection)); }