mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #48493 from nextcloud/backport/48445/stable27
[stable27] fix(Auth): ignore missing token when trying to set password-unconfirmable
This commit is contained in:
commit
ba452f953c
1 changed files with 15 additions and 6 deletions
|
|
@ -35,6 +35,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
use OC\Authentication\Exceptions\InvalidTokenException;
|
||||
use OC\Authentication\Exceptions\WipeTokenException;
|
||||
use OC\Authentication\Token\IProvider;
|
||||
use OC\User\LoginException;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
|
|
@ -42,6 +45,7 @@ use OCP\ILogger;
|
|||
use OCP\ISession;
|
||||
use OCP\IUserManager;
|
||||
use OCP\Server;
|
||||
use OCP\Session\Exceptions\SessionNotAvailableException;
|
||||
use OCP\User\Events\BeforeUserLoggedInEvent;
|
||||
use OCP\User\Events\UserLoggedInEvent;
|
||||
|
||||
|
|
@ -198,12 +202,17 @@ class OC_User {
|
|||
|
||||
if (empty($password)) {
|
||||
$tokenProvider = \OC::$server->get(IProvider::class);
|
||||
$token = $tokenProvider->getToken($userSession->getSession()->getId());
|
||||
$token->setScope([
|
||||
'password-unconfirmable' => true,
|
||||
'filesystem' => true,
|
||||
]);
|
||||
$tokenProvider->updateToken($token);
|
||||
try {
|
||||
$token = $tokenProvider->getToken($userSession->getSession()->getId());
|
||||
$token->setScope([
|
||||
'password-unconfirmable' => true,
|
||||
'filesystem' => true,
|
||||
]);
|
||||
$tokenProvider->updateToken($token);
|
||||
} catch (InvalidTokenException|WipeTokenException|SessionNotAvailableException) {
|
||||
// swallow the exceptions as we do not deal with them here
|
||||
// simply skip updating the token when is it missing
|
||||
}
|
||||
}
|
||||
|
||||
// setup the filesystem
|
||||
|
|
|
|||
Loading…
Reference in a new issue