Merge pull request #507 from jussiaho/patch-1

Use correct User model if overwritten in config
This commit is contained in:
Lorenzo Milesi
2023-02-23 13:21:32 +01:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,7 @@
- Fix: use correct password recovery url in welcome mail and add functionality to plain text version of the mail (@eluhr)
- Fix: correct viewPath error in LoginWidget (niciz)
- Enh: possibility to call all the api endpoints with either id or username or email (liviuk2)
- Fix: use configured User model in SecurityController 2FA confirmation (jussiaho)
## 1.6.0 January 9, 2023

View File

@ -221,9 +221,10 @@ class SecurityController extends Controller
$validators = $module->twoFactorAuthenticationValidators;
$credentials = Yii::$app->session->get('credentials');
$login = $credentials['login'];
$user = User::findOne(['email' => $login]);
$userModel = $this->getClassMap()->get(User::class);
$user = $userModel::findOne(['email' => $login]);
if ($user == null) {
$user = User::findOne(['username' => $login]);
$user = $userModel::findOne(['username' => $login]);
}
$tfType = $user->getAuthTfType();