You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
2.3 KiB
54 lines
2.3 KiB
<?php
|
|
|
|
namespace app\home\validate;
|
|
|
|
use think\Validate;
|
|
|
|
class LoginValidate extends BaseHomeValidate
|
|
{
|
|
|
|
protected $rule = [
|
|
'email' => 'require|email|length:5,40',
|
|
'email_code' => 'require|number',
|
|
'password' => 'require|isString|length:5,40',
|
|
'invite_code' => 'alphaDash',
|
|
'phone' => 'require|isString|length:5,40',
|
|
'nation' => 'require|isString',
|
|
'sms_code' => 'require|isString',
|
|
'device' => 'require|isString|length:2,100',
|
|
];
|
|
|
|
protected $message = [
|
|
'email.require' => 'The email is required.',
|
|
'email.email' => 'The email format is incorrect.',
|
|
'email.length' => 'The email length must be between 5 and 40 characters.',
|
|
'email_code.require' => 'The email verification code is required.',
|
|
'email_code.number' => 'The email verification code format is incorrect.',
|
|
'password.require' => 'The password is required.',
|
|
'password.isString' => 'The password is invalid.',
|
|
'password.length' => 'The password length is invalid.',
|
|
'invite_code.alphaDash' => 'The invitation code is invalid.',
|
|
'phone.require' => 'The phone number is required.',
|
|
'phone.number' => 'The phone number is invalid.',
|
|
'phone.length' => 'The phone number length must be between 5 and 40 characters.',
|
|
'nation.require' => 'The nation code is required.',
|
|
'nation.number' => 'The country code is invalid.',
|
|
'sms_code.require' => 'The SMS verification code is required.',
|
|
'sms_code.number' => 'The SMS verification code format is incorrect.',
|
|
'device.require' => 'The device type is required.',
|
|
'device.isString' => 'The device type format is incorrect.',
|
|
'device.length' => 'The device type parameter is incorrect.',
|
|
];
|
|
|
|
protected $scene = [
|
|
'sendEmail' => ['email'],
|
|
'emailRegister' => ['phone', 'email', 'email_code', 'password'],
|
|
'emailLogin' => ['email', 'password','device'],
|
|
'sendSms' => ['phone', 'nation'],
|
|
'smsRegister' => ['phone', 'nation','sms_code', 'password'],
|
|
'smsLogin' => ['phone', 'nation','sms_code','device'],
|
|
'emailForget' => ['email', 'email_code', 'password'],
|
|
'smsForget' => ['phone', 'nation','sms_code', 'password'],
|
|
'smsPasswordLogin' => ['phone', 'nation','password','device'],
|
|
];
|
|
}
|