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