Commit f27df995 authored by 赵啸非's avatar 赵啸非

更新用户同步逻辑

parent c2a132e8
......@@ -157,70 +157,4 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
return ret.toJSONString();
}
private void generateBlackCookie(HttpServletRequest request, HttpServletResponse response, String loginName, Set<String> urls) {
try {
String cacheKey = RedisKey.KEY_MENU_CACHE + loginName;
String securityKey = GlobalSysInfo.getPropertyValue(SysConstains.PROP_COOKIE_SECURITY_KEY);
//应为Cookie会超长,所以改为仅存储key将值放入redis
//CookieService.setCookieForAuth(request, response, securityKey, null);
StringBuilder sb = new StringBuilder();
if (urls != null && urls.size() > 0) {
for (String url : urls) {
int index = url.hashCode() & (Integer.MAX_VALUE - 1);
sb.append(index).append(",");
}
}
String menuUrl = sb.toString();
menuUrl = AESUtil.encrypt(menuUrl, securityKey);
cacheService.set(cacheKey, menuUrl, 604800);
HttpUtil.setCookieValue(request, response, SysConstains.COOKIE_MENU, cacheKey, -1);
} catch (Throwable e) {
}
}
@RequestMapping("validcode")
public String validCode(HttpServletRequest request, HttpServletResponse response, LoginForm loginForm) {
JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "登录名或密码为空");
}
UserEntity user = null;
try {
user = userService.doCheckUser(loginName, password);
if (user == null) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "用户名或密码不正确");
} else if (StringUtils.isEmpty(user.getMobile())) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "用户无正确的手机号");
} else {
String mobile = StringUtils.trim(user.getMobile());
String sessionId = request.getSession().getId();
String ip = super.getRequestIP(request);
boolean result = validCodeService.createSmsValidCode(sessionId, ip, mobile);
if (result) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} else {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "验证码发送失败,请稍后在试!");
}
}
} catch (Exception e) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "验证码发送失败:" + super.convertException(e));
} finally {
if (user == null) {
user = new UserEntity();
user.setLoginName(loginName);
}
recordSysLog(request, user, "用户获取短信验证码");
}
return ret.toJSONString();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment