修复错误的验证规则
This commit is contained in:
parent
eb6cf82904
commit
068af76756
@ -42,10 +42,10 @@ class User extends \yii\db\ActiveRecord implements IdentityInterface
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['username', 'password', 'password2'], 'required', 'on' => 'login'],
|
[['username', 'password'], 'required', 'on' => 'login'],
|
||||||
[['username', 'password', 'email', 'password2'], 'required', 'on' => 'register'],
|
[['username', 'password', 'email', 'password2'], 'required', 'on' => 'register'],
|
||||||
['username', 'string', 'min' => 3, 'max' => 12],
|
['username', 'string', 'min' => 3, 'max' => 12],
|
||||||
['password', 'string', 'min' => 6, 'max' => 12],
|
['password', 'string', 'min' => 6, 'max' => 24],
|
||||||
['password2', 'compare', 'compareAttribute' => 'password', 'on' => 'register'],
|
['password2', 'compare', 'compareAttribute' => 'password', 'on' => 'register'],
|
||||||
['email', 'email', 'on' => 'register'],
|
['email', 'email', 'on' => 'register'],
|
||||||
['username', 'unique', 'on' => 'register'],
|
['username', 'unique', 'on' => 'register'],
|
||||||
|
Loading…
Reference in New Issue
Block a user