Last active
September 28, 2016 20:09
-
-
Save lav45/02d4fb98171e3438b769 to your computer and use it in GitHub Desktop.
Yii2 Убираем валидацию с LoginForm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param yii\base\ModelEvent $event | |
*/ | |
$func = function($event) { | |
/** @var common\models\LoginForm $model */ | |
$model = $event->sender; | |
foreach($model->validators as $key => $item) { | |
if ($item instanceof yii\validators\InlineValidator && $item->method == 'validatePassword') { | |
unset($model->validators[$key]); | |
} | |
} | |
}; | |
/** | |
* Убираем валидацию с LoginForm | |
* Используется при отсутствии доступа к LDAP | |
*/ | |
\yii\base\Event::on('common\models\LoginForm', 'beforeValidate', $func); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment