diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-01-29 21:50:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-29 21:50:15 +0300 |
commit | deb7d2364f38ce24bee62cd490fccfd6e4d3f059 (patch) | |
tree | 4c089bbc0adce35d42e53b06c3da74632718a371 /core/Controller | |
parent | 050b9135d50f57c777c157bb7aa8c102524b2c77 (diff) | |
parent | ac8a6e22448cd4077e73b68731764bd60775665a (diff) |
Merge pull request #13869 from nextcloud/enh/clean_pending_2fa_session_on_password_change
Clean pending 2FA authentication on password reset
Diffstat (limited to 'core/Controller')
-rw-r--r-- | core/Controller/LostController.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index ed802aca582..96018555ec3 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -31,6 +31,7 @@ namespace OC\Core\Controller; +use OC\Authentication\TwoFactorAuth\Manager; use OC\HintException; use \OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; @@ -58,7 +59,6 @@ use OCP\Security\ISecureRandom; * @package OC\Core\Controller */ class LostController extends Controller { - /** @var IURLGenerator */ protected $urlGenerator; /** @var IUserManager */ @@ -83,6 +83,8 @@ class LostController extends Controller { protected $crypto; /** @var ILogger */ private $logger; + /** @var Manager */ + private $twoFactorManager; /** * @param string $appName @@ -112,7 +114,8 @@ class LostController extends Controller { IMailer $mailer, ITimeFactory $timeFactory, ICrypto $crypto, - ILogger $logger) { + ILogger $logger, + Manager $twoFactorManager) { parent::__construct($appName, $request); $this->urlGenerator = $urlGenerator; $this->userManager = $userManager; @@ -126,6 +129,7 @@ class LostController extends Controller { $this->timeFactory = $timeFactory; $this->crypto = $crypto; $this->logger = $logger; + $this->twoFactorManager = $twoFactorManager; } /** @@ -290,6 +294,8 @@ class LostController extends Controller { \OC_Hook::emit('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', array('uid' => $userId, 'password' => $password)); + $this->twoFactorManager->clearTwoFactorPending($userId); + $this->config->deleteUserValue($userId, 'core', 'lostpassword'); @\OC::$server->getUserSession()->unsetMagicInCookie(); } catch (HintException $e){ |