|
@ -3,6 +3,8 @@ |
|
|
|
|
|
|
|
|
use yii\base\Model; |
|
|
use yii\base\Model; |
|
|
use wiggins\myProject\validators\MyValidator; |
|
|
use wiggins\myProject\validators\MyValidator; |
|
|
|
|
|
use wiggins\myProject\validators\HKPhoneNumValidator; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* UserInput类是用于用户登录或注册场景中输入数据 |
|
|
* UserInput类是用于用户登录或注册场景中输入数据 |
|
@ -21,6 +23,11 @@ |
|
|
*/ |
|
|
*/ |
|
|
public $email; |
|
|
public $email; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 香港电话号码 |
|
|
|
|
|
*/ |
|
|
|
|
|
public $hkPhoneNum; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @var string 密码 |
|
|
* @var string 密码 |
|
|
*/ |
|
|
*/ |
|
@ -49,6 +56,7 @@ |
|
|
return [ |
|
|
return [ |
|
|
'name' => '3-20个英文或数字字符', |
|
|
'name' => '3-20个英文或数字字符', |
|
|
'email' => '你的邮箱地址', |
|
|
'email' => '你的邮箱地址', |
|
|
|
|
|
'hkPhoneNum'=> '香港电话号码', |
|
|
'password' => '3-10个英文或数字字符', |
|
|
'password' => '3-10个英文或数字字符', |
|
|
'pwdConfirm' => '需要与密码一致', |
|
|
'pwdConfirm' => '需要与密码一致', |
|
|
]; |
|
|
]; |
|
@ -61,7 +69,7 @@ |
|
|
{ |
|
|
{ |
|
|
return[ |
|
|
return[ |
|
|
self::SCENARIO_LOGIN => ['name','password'], |
|
|
self::SCENARIO_LOGIN => ['name','password'], |
|
|
self::SCENARIO_REGISTER => ['name','email','password','pwdConfirm'], |
|
|
|
|
|
|
|
|
self::SCENARIO_REGISTER => ['name','email','hkPhoneNum','password','pwdConfirm'], |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -75,9 +83,10 @@ |
|
|
['email','email'], |
|
|
['email','email'], |
|
|
['password','string','length'=>[3,10]], |
|
|
['password','string','length'=>[3,10]], |
|
|
['pwdConfirm','compare','compareAttribute'=>'password','message'=>'两次密码必须一致'], |
|
|
['pwdConfirm','compare','compareAttribute'=>'password','message'=>'两次密码必须一致'], |
|
|
[['name','email','password','pwdConfirm'],'required','on'=>'register'], |
|
|
|
|
|
|
|
|
[['name','email','hkPhoneNum','password','pwdConfirm'],'required','on'=>'register'], |
|
|
[['name','password'],'required','on'=>'login'], |
|
|
[['name','password'],'required','on'=>'login'], |
|
|
['name','wiggins\myProject\validators\MyValidator'], |
|
|
['name','wiggins\myProject\validators\MyValidator'], |
|
|
|
|
|
['hkPhoneNum','wiggins\myProject\validators\HKPhoneNumValidator'], |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|