Commit a5e6e2d4 by Johnny Theill

username should be unique

parent e2aacad8
......@@ -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