mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
fix(Token): make new scope future compatible
- "password-unconfirmable" is the effective name for 30, but a draft name was backported. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
02313013ad
commit
3b840dfb79
4 changed files with 4 additions and 4 deletions
|
|
@ -103,7 +103,7 @@ class PasswordConfirmationMiddleware extends Middleware {
|
|||
return;
|
||||
}
|
||||
$scope = $token->getScopeAsArray();
|
||||
if (isset($scope['sso-based-login']) && $scope['sso-based-login'] === true) {
|
||||
if (isset($scope['password-unconfirmable']) && $scope['password-unconfirmable'] === true) {
|
||||
// Users logging in from SSO backends cannot confirm their password by design
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,6 +309,6 @@ class JSConfigHelper {
|
|||
return true;
|
||||
}
|
||||
$scope = $token->getScopeAsArray();
|
||||
return !isset($scope['sso-based-login']) || $scope['sso-based-login'] === false;
|
||||
return !isset($scope['password-unconfirmable']) || $scope['password-unconfirmable'] === false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ class OC_User {
|
|||
if (empty($password)) {
|
||||
$tokenProvider = \OC::$server->get(IProvider::class);
|
||||
$token = $tokenProvider->getToken($userSession->getSession()->getId());
|
||||
$token->setScope(['sso-based-login' => true]);
|
||||
$token->setScope(['password-unconfirmable' => true]);
|
||||
$tokenProvider->updateToken($token);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
|
|||
|
||||
$token = $this->createMock(IToken::class);
|
||||
$token->method('getScopeAsArray')
|
||||
->willReturn(['sso-based-login' => true]);
|
||||
->willReturn(['password-unconfirmable' => true]);
|
||||
$this->tokenProvider->expects($this->once())
|
||||
->method('getToken')
|
||||
->with($sessionId)
|
||||
|
|
|
|||
Loading…
Reference in a new issue