Commit fe48ae0d by Alexander Makarov

Merge pull request #2657 from Theill11/fix-validation

Advanced app: Username should be unique
parents e2aacad8 a5e6e2d4
......@@ -196,6 +196,7 @@ class User extends ActiveRecord implements IdentityInterface
['username', 'filter', 'filter' => 'trim'],
['username', 'required'],
['username', 'unique'],
['username', 'string', 'min' => 2, 'max' => 255],
['email', 'filter', 'filter' => 'trim'],
......
......@@ -22,6 +22,7 @@ class SignupForm extends Model
return [
['username', 'filter', 'filter' => 'trim'],
['username', 'required'],
['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'],
['username', 'string', 'min' => 2, 'max' => 255],
['email', 'filter', 'filter' => 'trim'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment