mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 18:50:47 -04:00
fix(session): Ensure token and UID are valid
Wrap token retrieval in try-catch to handle InvalidTokenException. Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
This commit is contained in:
parent
c316ed655a
commit
9964198a93
1 changed files with 12 additions and 1 deletions
|
|
@ -411,8 +411,19 @@ class Session implements IUserSession, Emitter {
|
|||
}
|
||||
|
||||
if ($isTokenPassword) {
|
||||
$dbToken = $this->tokenProvider->getToken($password);
|
||||
try {
|
||||
$dbToken = $this->tokenProvider->getToken($password);
|
||||
} catch (InvalidTokenException $ex) {
|
||||
$this->handleLoginFailed($throttler, $currentDelay, $remoteAddress, $user, $password);
|
||||
return false;
|
||||
}
|
||||
|
||||
$userFromToken = $this->manager->get($dbToken->getUID());
|
||||
if ($userFromToken === null) {
|
||||
$this->handleLoginFailed($throttler, $currentDelay, $remoteAddress, $user, $password);
|
||||
return false;
|
||||
}
|
||||
|
||||
$isValidEmailLogin = $userFromToken->getEMailAddress() === $user
|
||||
&& $this->validateTokenLoginName($userFromToken->getEMailAddress(), $dbToken);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue