From 56ab293f451139ffad5b666bdb38aa37b59d76e5 Mon Sep 17 00:00:00 2001 From: Egorka Date: Wed, 21 Mar 2018 18:14:49 +0300 Subject: [PATCH] User form unique email fix --- core/forms/user/UserForm.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/forms/user/UserForm.php b/core/forms/user/UserForm.php index e40f190..0f11fc4 100644 --- a/core/forms/user/UserForm.php +++ b/core/forms/user/UserForm.php @@ -34,7 +34,8 @@ class UserForm extends Model [['username', 'email', 'role'], 'required'], ['email', 'email'], ['email', 'string', 'max' => 255], - [['username', 'email'], 'unique', 'targetClass' => User::class, 'filter' => ['<>', 'id', $this->_user->id]], + //[['username', 'email'], 'unique', 'targetClass' => User::class, 'filter' => ['<>', 'id', $this->_user->id]], + [['username', 'email'], 'unique', 'targetClass' => User::class, 'filter' => isset($this->_user->id) ? ['<>', 'id', $this->_user->id] : null ], ['password', 'string', 'min' => 6], ]; }