Use correct User model if overwritten in config
Two factor authentication doesn't work if the User model has been changed in the config from the modules own model class. This fix gets the correct User model from the class map.
This commit is contained in:
@ -221,9 +221,10 @@ class SecurityController extends Controller
|
|||||||
$validators = $module->twoFactorAuthenticationValidators;
|
$validators = $module->twoFactorAuthenticationValidators;
|
||||||
$credentials = Yii::$app->session->get('credentials');
|
$credentials = Yii::$app->session->get('credentials');
|
||||||
$login = $credentials['login'];
|
$login = $credentials['login'];
|
||||||
$user = User::findOne(['email' => $login]);
|
$userModel = $this->getClassMap()->get(User::class);
|
||||||
|
$user = $userModel::findOne(['email' => $login]);
|
||||||
if ($user == null) {
|
if ($user == null) {
|
||||||
$user = User::findOne(['username' => $login]);
|
$user = $userModel::findOne(['username' => $login]);
|
||||||
}
|
}
|
||||||
$tfType = $user->getAuthTfType();
|
$tfType = $user->getAuthTfType();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user