diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2021-08-19 12:40:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-19 12:40:40 +0200 |
commit | 4b0e18ae1b533cca6e9da8031ea55491718280c8 (patch) | |
tree | ff219d60b911bd2c525d49fb4574bc3e61f88a67 /core/Controller/TwoFactorChallengeController.php | |
parent | 3dc7fd27f177993e4032c71789fac55e0af01880 (diff) | |
parent | b1086e25bb9c92c939116201fe7893ab9a88123a (diff) | |
download | nextcloud-server-4b0e18ae1b533cca6e9da8031ea55491718280c8.tar.gz nextcloud-server-4b0e18ae1b533cca6e9da8031ea55491718280c8.zip |
Merge pull request #27294 from pjft/patch-2
Update TwoFactorChallengeController.php
Diffstat (limited to 'core/Controller/TwoFactorChallengeController.php')
-rw-r--r-- | core/Controller/TwoFactorChallengeController.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php index e08454caea6..30f33230d8f 100644 --- a/core/Controller/TwoFactorChallengeController.php +++ b/core/Controller/TwoFactorChallengeController.php @@ -35,6 +35,7 @@ use OCP\Authentication\TwoFactorAuth\IActivatableAtLogin; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\Authentication\TwoFactorAuth\IProvidesCustomCSP; use OCP\Authentication\TwoFactorAuth\TwoFactorException; +use OCP\ILogger; use OCP\IRequest; use OCP\ISession; use OCP\IURLGenerator; @@ -51,6 +52,9 @@ class TwoFactorChallengeController extends Controller { /** @var ISession */ private $session; + /** @var ILogger */ + private $logger; + /** @var IURLGenerator */ private $urlGenerator; @@ -61,14 +65,16 @@ class TwoFactorChallengeController extends Controller { * @param IUserSession $userSession * @param ISession $session * @param IURLGenerator $urlGenerator + * @param ILogger $logger */ public function __construct($appName, IRequest $request, Manager $twoFactorManager, IUserSession $userSession, - ISession $session, IURLGenerator $urlGenerator) { + ISession $session, IURLGenerator $urlGenerator, ILogger $logger) { parent::__construct($appName, $request); $this->twoFactorManager = $twoFactorManager; $this->userSession = $userSession; $this->session = $session; $this->urlGenerator = $urlGenerator; + $this->logger = $logger; } /** @@ -208,6 +214,9 @@ class TwoFactorChallengeController extends Controller { $this->session->set('two_factor_auth_error_message', $e->getMessage()); } + $ip = $this->request->getRemoteAddress(); + $uid = $user->getUID(); + $this->logger->warning("Two-factor challenge failed: $uid (Remote IP: $ip)"); $this->session->set('two_factor_auth_error', true); return new RedirectResponse($this->urlGenerator->linkToRoute('core.TwoFactorChallenge.showChallenge', [ 'challengeProviderId' => $provider->getId(), |