diff --git a/app/controller/UserController.php b/app/controller/UserController.php index c52ac14..e8f423e 100644 --- a/app/controller/UserController.php +++ b/app/controller/UserController.php @@ -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); diff --git a/resource/translations/en/messages.php b/resource/translations/en/messages.php index e58e791..dffe5e5 100644 --- a/resource/translations/en/messages.php +++ b/resource/translations/en/messages.php @@ -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', ]; \ No newline at end of file diff --git a/resource/translations/zh_CN/messages.php b/resource/translations/zh_CN/messages.php index 04b6f8d..09ede6c 100644 --- a/resource/translations/zh_CN/messages.php +++ b/resource/translations/zh_CN/messages.php @@ -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位', ]; \ No newline at end of file