Commit ea7ab5e1 authored by “yiyousong”'s avatar “yiyousong”
parents 35581637 2a7a1c0b
......@@ -120,7 +120,11 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
return ret.toJSONString();
} catch (Exception e) {
log.error("login error ", e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
if(e instanceof AppException){
ret.put(KEY_RESULT_CODE, ((AppException) e).getCode());
}else {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
}
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
......
......@@ -210,7 +210,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
if(sysUser.getLastUpdatePwdTime()!=null) {
long day = DateUtils.getBetween(sysUser.getLastUpdatePwdTime(), new Date(), 2);
if (day >= 90) {
throw new AppException("密码已超过三个月没有更改,请修改以后再登录");
throw new AppException(99998,"密码已超过三个月没有更改,请修改以后再登录");
}
}
}
......
......@@ -174,6 +174,25 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
return ret.toJSONString();
}
@RequestMapping(value = "forgot/password", method = RequestMethod.POST)
@UnAuth
public String forgotPassword(@RequestBody UserEntity entity) {
JSONObject ret = new JSONObject();
try {
String oldPwd = LoginAESUtil.decrypt(entity.getOldPwd(),AES_KEY,AES_IV,LoginAESUtil.AES_CBC);
String newPwd = LoginAESUtil.decrypt(entity.getNewPwd(),AES_KEY,AES_IV,LoginAESUtil.AES_CBC);
entity.setOldPwd(oldPwd);
entity.setNewPwd(newPwd);
service.updateUserPwd(entity.getLoginName(), entity.getOldPwd(), entity.getNewPwd());
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "密码修改成功!");
} catch (Exception e) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
}
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