Merge pull request #486 from liviuk2/patch-2

User model emailTrim validator only if not empty
This commit is contained in:
Lorenzo Milesi
2022-12-20 15:41:47 +01:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@ -40,6 +40,7 @@ There's a change in flash messages handling, please see #391
- Fix: check user before accessing 2FA code
- Enh: added `AdminController` REST controller (MatteoF96)
- Enh: added method `setUser` for LoginForm model (liviuk2)
- Enh: user model emailTrim validator only if not empty #486 (liviuk2)
## 1.5.1 April 5, 2020

View File

@ -250,7 +250,7 @@ class User extends ActiveRecord implements IdentityInterface
'unique',
'message' => Yii::t('usuario', 'This email address has already been taken'),
],
'emailTrim' => ['email', 'trim'],
'emailTrim' => ['email', 'trim', 'skipOnEmpty' => true],
// password rules
'passwordTrim' => ['password', 'trim'],