Skip to content

Commit

Permalink
注册时,手机注册邮箱默认为空
Browse files Browse the repository at this point in the history
  • Loading branch information
xutl committed Sep 8, 2017
1 parent 3fc6524 commit 8baebde
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function rules()
'slugTrim' => ['slug', 'trim'],

// username rules
'usernameRequired' => ['username', 'required', 'on' => ['register', 'create', 'connect', 'update', 'wechat_register']],
'usernameRequired' => ['username', 'required', 'on' => ['register', 'create', 'connect', 'update', 'mobile_register', 'wechat_register']],
'usernameMatch' => ['username', 'match', 'pattern' => static::$usernameRegexp],
'usernameLength' => ['username', 'string', 'min' => 3, 'max' => 255],
'usernameUnique' => ['username', 'unique', 'message' => Yii::t('user', 'This username has already been taken')],
Expand All @@ -217,13 +217,14 @@ public function rules()
'emailLength' => ['email', 'string', 'max' => 255],
'emailUnique' => ['email', 'unique', 'message' => Yii::t('user', 'This email address has already been taken')],
'emailTrim' => ['email', 'trim'],
'emailDefault' => ['email', 'default', 'value' => null, 'on' => ['mobile_register']],

//mobile rules
'mobileRequired' => ['mobile', 'required', 'on' => ['mobile_register']],
'mobilePattern' => ['mobile', 'match', 'pattern' => static::$mobileRegexp],
'mobileLength' => ['mobile', 'string', 'max' => 11],
'mobileUnique' => ['mobile', 'unique', 'message' => Yii::t('user', 'This mobile address has already been taken')],
//'mobileTrim' => ['mobile', 'trim'],
'mobileDefault' => ['email', 'default', 'value' => null, 'on' => ['register', 'create']],

// password rules
'passwordRequired' => ['password', 'required', 'on' => ['register', 'mobile_register']],
Expand Down

0 comments on commit 8baebde

Please sign in to comment.