diff --git a/src/app/Auth/LDAPUserProvider.php b/src/app/Auth/LDAPUserProvider.php index 5d949760..cbf020a1 100644 --- a/src/app/Auth/LDAPUserProvider.php +++ b/src/app/Auth/LDAPUserProvider.php @@ -1,71 +1,71 @@ count() == 1) { $user = $entries->select('id', 'email', 'password', 'password_ldap')->first(); return $user; } return null; } public function validateCredentials(Authenticatable $user, array $credentials) { if ($user->email == $credentials['email']) { if (!empty($user->password)) { if (Hash::check($credentials['password'], $user->password)) { // TODO: update last login time // TODO: Update password_ldap if necessary, examine whether writing to // user->password is sufficient? $user->password = $credentials['password']; $user->save(); return true; } else { // TODO: Log login failure return false; } - } else if (!empty($user->password_ldap)) { + } elseif (!empty($user->password_ldap)) { $hash = '{SSHA512}' . base64_encode( pack('H*', hash('sha512', $credentials['password'])) ); if ($hash == $user->password_ldap) { // TODO: update last login time // TODO: Update password if necessary, examine whether writing to // user->password is sufficient? $user->password = $credentials['password']; $user->save(); return true; } else { // TODO: Log login failure return false; } } else { // TODO: Log login failure for missing password. Try actual LDAP? return false; } } return false; } } diff --git a/src/routes/web.php b/src/routes/web.php index f5d96ba6..75ec6f9f 100644 --- a/src/routes/web.php +++ b/src/routes/web.php @@ -1,19 +1,21 @@