commit 199daeddbb6c5224958377a13862a6131732a6a5
parent cc0dc8f0047740b9a423d7a87377c6912a39eaf7
Author: Jan Dankert <develop@jandankert.de>
Date: Mon, 30 Nov 2020 10:31:50 +0100
Fix: Reset password fail counter after successful login.
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/cms/action/login/LoginLoginAction.class.php b/modules/cms/action/login/LoginLoginAction.class.php
@@ -204,6 +204,7 @@ class LoginLoginAction extends LoginAction implements Method {
$user = User::loadWithName($loginName, User::AUTH_TYPE_INTERNAL, null);
$user->setCurrent();
$user->updateLoginTimestamp();
+ $user->resetFailedPasswordCounter();
if ($user->passwordAlgo != Password::bestAlgoAvailable())
// Re-Hash the password with a better hash algo.
@@ -273,7 +274,7 @@ class LoginLoginAction extends LoginAction implements Method {
Session::setConfig( $config );
}
else {
- throw new \LogicException('unreachable code: Auth module must return either SUCCESS or FAIL');
+ throw new \LogicException('Auth module must return either SUCCESS or FAIL, but got '.$authResult);
}
}
diff --git a/modules/cms/model/User.class.php b/modules/cms/model/User.class.php
@@ -1160,6 +1160,12 @@ SQL
}
+ public function resetFailedPasswordCounter() {
+ $this->passwordFailedCount = 0;
+ $this->save();
+ }
+
+
public function getId()
{
return $this->userid;