mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-06 02:24:33 +08:00
Fixed not shown existing-email warning on new ldap user
- Reduced the amount of different exceptions from LDAP attempt so they can be handled more consistently. - Added test to cover. - Also cleaned up LDAP tests to reduce boilterplate mocks. Fixes #2048
This commit is contained in:
@ -60,10 +60,8 @@ class LdapSessionGuard extends ExternalBaseSessionGuard
|
||||
* @param array $credentials
|
||||
* @param bool $remember
|
||||
* @return bool
|
||||
* @throws LoginAttemptEmailNeededException
|
||||
* @throws LoginAttemptException
|
||||
* @throws LdapException
|
||||
* @throws UserRegistrationException
|
||||
*/
|
||||
public function attempt(array $credentials = [], $remember = false)
|
||||
{
|
||||
@ -82,7 +80,11 @@ class LdapSessionGuard extends ExternalBaseSessionGuard
|
||||
}
|
||||
|
||||
if (is_null($user)) {
|
||||
$user = $this->createNewFromLdapAndCreds($userDetails, $credentials);
|
||||
try {
|
||||
$user = $this->createNewFromLdapAndCreds($userDetails, $credentials);
|
||||
} catch (UserRegistrationException $exception) {
|
||||
throw new LoginAttemptException($exception->message);
|
||||
}
|
||||
}
|
||||
|
||||
// Sync LDAP groups if required
|
||||
|
@ -8,8 +8,6 @@ class NotifyException extends \Exception
|
||||
|
||||
/**
|
||||
* NotifyException constructor.
|
||||
* @param string $message
|
||||
* @param string $redirectLocation
|
||||
*/
|
||||
public function __construct(string $message, string $redirectLocation = "/")
|
||||
{
|
||||
|
Reference in New Issue
Block a user