|
|
|
@ -41,9 +41,11 @@ public class SysRegisterService |
|
|
|
|
public String register(RegisterBody registerBody) |
|
|
|
|
{ |
|
|
|
|
String msg = "", username = registerBody.getUsername(), password = registerBody.getPassword(); |
|
|
|
|
SysUser sysUser = new SysUser(); |
|
|
|
|
sysUser.setUserName(username); |
|
|
|
|
|
|
|
|
|
boolean captchaEnabled = configService.selectCaptchaEnabled(); |
|
|
|
|
// 验证码开关
|
|
|
|
|
boolean captchaEnabled = configService.selectCaptchaEnabled(); |
|
|
|
|
if (captchaEnabled) |
|
|
|
|
{ |
|
|
|
|
validateCaptcha(username, registerBody.getCode(), registerBody.getUuid()); |
|
|
|
@ -67,16 +69,14 @@ public class SysRegisterService |
|
|
|
|
{ |
|
|
|
|
msg = "密码长度必须在5到20个字符之间"; |
|
|
|
|
} |
|
|
|
|
else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(username))) |
|
|
|
|
else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(sysUser))) |
|
|
|
|
{ |
|
|
|
|
msg = "保存用户'" + username + "'失败,注册账号已存在"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
SysUser sysUser = new SysUser(); |
|
|
|
|
sysUser.setUserName(username); |
|
|
|
|
sysUser.setNickName(username); |
|
|
|
|
sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword())); |
|
|
|
|
sysUser.setPassword(SecurityUtils.encryptPassword(password)); |
|
|
|
|
boolean regFlag = userService.registerUser(sysUser); |
|
|
|
|
if (!regFlag) |
|
|
|
|
{ |
|
|
|
@ -84,8 +84,7 @@ public class SysRegisterService |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, |
|
|
|
|
MessageUtils.message("user.register.success"))); |
|
|
|
|
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, MessageUtils.message("user.register.success"))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return msg; |
|
|
|
|