A free open source IT asset/license management system
Put decrypt in a try/catch
snipe5d9dc0e74d03
diff --git a/app/Console/Commands/LdapTroubleshooter.php b/app/Console/Commands/LdapTroubleshooter.phpindex f9b9f4bb0d..8c45bcf6c6 100644--- a/app/Console/Commands/LdapTroubleshooter.php+++ b/app/Console/Commands/LdapTroubleshooter.php@@ -161,7 +161,15 @@ class LdapTroubleshooter extends Command$output[] = "-x";$output[] = "-b ".escapeshellarg($settings->ldap_basedn);$output[] = "-D ".escapeshellarg($settings->ldap_uname);- $output[] = "-w ".escapeshellarg(Crypt::Decrypt($settings->ldap_pword));++ try {+ $w = Crypt::Decrypt($settings->ldap_pword);+ } catch (\Exception $e) {+ $this->warn("Could not decrypt password. This usually means an LDAP password was not set or the APP_KEY was changed since the LDAP pasword was last saved. Aborting.");+ exit(0);+ }++ $output[] = "-w ". escapeshellarg($w);$output[] = escapeshellarg(parenthesized_filter($settings->ldap_filter));if($settings->ldap_tls) {$this->line("# adding STARTTLS option");