提示校验优化

This commit is contained in:
2025-03-24 11:09:59 +08:00
parent b9f5e671bc
commit b7775cafcf
3 changed files with 8 additions and 1 deletions
+4 -1
View File
@@ -81,7 +81,7 @@ class UserController
{
$email = Util::getParam($request, '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) {
return Util::fail([], trans('code_error'));
}
if(strlen($password) < 6) {
return Util::fail([], trans('password_short'));
}
//加密
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
+2
View File
@@ -10,6 +10,7 @@ return [
'code_error' => ' code error',
'format_error' => ' format error',
'email_repeat' => ' email repeat',
'email_error' => ' Email format 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' => ' Inconsistent email addresses',
'sign_not_null' => ' No affiliated company has been set',
'password_short' => ' Password cannot be less than 6 characters',
];
+2
View File
@@ -10,6 +10,7 @@ return [
'code_error' => ' 验证码错误',
'format_error' => ' 格式错误',
'email_repeat' => ' 邮箱重复',
'email_error' => ' 邮箱格式错误',
'save_success' => ' 保存成功',
'save_fail' => ' 保存失败',
'register_success' => ' 注册成功',
@@ -24,4 +25,5 @@ return [
'channel_not_null' => ' 渠道不能为空',
'email_consistent' => ' 邮箱不一致',
'sign_not_null' => ' 未设置所属公司',
'password_short' => ' 密码不能少于6位',
];