提示校验优化
This commit is contained in:
@@ -81,7 +81,7 @@ class UserController
|
|||||||
{
|
{
|
||||||
$email = Util::getParam($request, 'email');
|
$email = Util::getParam($request, 'email');
|
||||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
return Util::fail([], trans('required_not_null'));
|
return Util::fail([], trans('email_error'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成验证码
|
// 生成验证码
|
||||||
@@ -138,6 +138,9 @@ class UserController
|
|||||||
if ($code != $verification_code) {
|
if ($code != $verification_code) {
|
||||||
return Util::fail([], trans('code_error'));
|
return Util::fail([], trans('code_error'));
|
||||||
}
|
}
|
||||||
|
if(strlen($password) < 6) {
|
||||||
|
return Util::fail([], trans('password_short'));
|
||||||
|
}
|
||||||
|
|
||||||
//加密
|
//加密
|
||||||
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
|
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ return [
|
|||||||
'code_error' => ' code error',
|
'code_error' => ' code error',
|
||||||
'format_error' => ' format error',
|
'format_error' => ' format error',
|
||||||
'email_repeat' => ' email repeat',
|
'email_repeat' => ' email repeat',
|
||||||
|
'email_error' => ' Email format error',
|
||||||
'save_success' => ' save success',
|
'save_success' => ' save success',
|
||||||
'save_fail' => ' save fail',
|
'save_fail' => ' save fail',
|
||||||
'register_success' => ' register success',
|
'register_success' => ' register success',
|
||||||
@@ -24,4 +25,5 @@ return [
|
|||||||
'channel_not_null' => ' channel not null',
|
'channel_not_null' => ' channel not null',
|
||||||
'email_consistent' => ' Inconsistent email addresses',
|
'email_consistent' => ' Inconsistent email addresses',
|
||||||
'sign_not_null' => ' No affiliated company has been set',
|
'sign_not_null' => ' No affiliated company has been set',
|
||||||
|
'password_short' => ' Password cannot be less than 6 characters',
|
||||||
];
|
];
|
||||||
@@ -10,6 +10,7 @@ return [
|
|||||||
'code_error' => ' 验证码错误',
|
'code_error' => ' 验证码错误',
|
||||||
'format_error' => ' 格式错误',
|
'format_error' => ' 格式错误',
|
||||||
'email_repeat' => ' 邮箱重复',
|
'email_repeat' => ' 邮箱重复',
|
||||||
|
'email_error' => ' 邮箱格式错误',
|
||||||
'save_success' => ' 保存成功',
|
'save_success' => ' 保存成功',
|
||||||
'save_fail' => ' 保存失败',
|
'save_fail' => ' 保存失败',
|
||||||
'register_success' => ' 注册成功',
|
'register_success' => ' 注册成功',
|
||||||
@@ -24,4 +25,5 @@ return [
|
|||||||
'channel_not_null' => ' 渠道不能为空',
|
'channel_not_null' => ' 渠道不能为空',
|
||||||
'email_consistent' => ' 邮箱不一致',
|
'email_consistent' => ' 邮箱不一致',
|
||||||
'sign_not_null' => ' 未设置所属公司',
|
'sign_not_null' => ' 未设置所属公司',
|
||||||
|
'password_short' => ' 密码不能少于6位',
|
||||||
];
|
];
|
||||||
Reference in New Issue
Block a user