Skip to content

Commit 7e64658

Browse files
committed
fix updating and deleting authtokens
1 parent dcae3e7 commit 7e64658

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/settings/lib/Controller/AuthSettingsController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
use BadMethodCallException;
3131
use OC\Authentication\Exceptions\InvalidTokenException;
32+
use OC\Authentication\Exceptions\ExpiredTokenException;
3233
use OC\Authentication\Exceptions\PasswordlessTokenException;
3334
use OC\Authentication\Exceptions\WipeTokenException;
3435
use OC\Authentication\Token\INamedToken;
@@ -259,10 +260,13 @@ private function publishActivity(string $subject, int $id, array $parameters = [
259260
* @param int $id
260261
* @return IToken
261262
* @throws InvalidTokenException
262-
* @throws \OC\Authentication\Exceptions\ExpiredTokenException
263263
*/
264264
private function findTokenByIdAndUser(int $id): IToken {
265-
$token = $this->tokenProvider->getTokenById($id);
265+
try {
266+
$token = $this->tokenProvider->getTokenById($id);
267+
} catch (ExpiredTokenException $e) {
268+
$token = $e->getToken();
269+
}
266270
if ($token->getUID() !== $this->uid) {
267271
throw new InvalidTokenException('This token does not belong to you!');
268272
}

0 commit comments

Comments
 (0)