1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-01 22:53:29 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

引入sweetalert代替alert;用户注册密码长度及字符校验;注册页前端显示密码策略及样式优化;字体渲染显示网页逻辑调整;后端添加40004错误码

This commit is contained in:
2022-04-28 19:34:00 +08:00
parent 3028d0d008
commit 1378ef1bdf
32 changed files with 291 additions and 184 deletions

View File

@@ -22,6 +22,7 @@ public enum BusinessErrorCode implements CommonError {
THIRD_PARTY_LOGIN_FAIL(40001, "第三方登录失败"),
THIRD_PARTY_ACCOUNT_ALREADY_BOUND(40002, "该账号已被其他账号绑定"),
THIRD_PARTY_UNBIND_FAIL(40003, "第三方账号解绑失败"),
THIRD_PARTY_ACCOUNT_NOT_EXIST(40004, "当前第三方账号未绑定到系统账号"),
// 50000开头为书籍相关错误定义
BOOK_NOT_EXIST(50001, "书籍不存在"),

View File

@@ -67,8 +67,14 @@ public class UserController extends BaseController {
public CommonReturnType register(@RequestParam(value = "username") String username,
@RequestParam(value = "password") String password,
@RequestParam(value = "visitorId") String visitorFingerprint) throws BusinessException {
if (username == null || password == null) {
return null;
if (username == null || username.equals("")) {
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "用户名不能为空");
}
if (password == null || password.equals("")) {
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "密码不能为空");
}
if (!password.matches("[A-Za-z0-9_!@#]{8,16}$")) {
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "密码不符合要求,请检查");
}
String encryptPwd = DigestUtils.sha1Hex(password);

View File

@@ -84,11 +84,11 @@ public class ThirdPartyUserServiceImpl implements ThirdPartyUserService {
return userModel;
} else {
// 未绑定到系统账号
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "第三方登录失败,该第三方账号未绑定到系统账号,请先绑定");
throw new BusinessException(BusinessErrorCode.THIRD_PARTY_ACCOUNT_NOT_EXIST, "第三方登录失败,该第三方账号未绑定到系统账号,请先绑定");
}
} else {
// 之前未授权登录过
throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "第三方登录失败,该第三方账号未绑定到系统账号,请先绑定");
throw new BusinessException(BusinessErrorCode.THIRD_PARTY_ACCOUNT_NOT_EXIST, "第三方登录失败,该第三方账号未绑定到系统账号,请先绑定");
}
} else {
// 未知错误