/**
* 修改个人密码
* */
@RequestMapping(value="/member/modifypwd.do")
public ModelAndView modifyLoginPasswd(HttpServletRequest request,HttpServletResponse response){
RunTimeUser currentUser = RunTimeUser.getRunTimeUser(request);
String paramId = request.getParameter("rd");
String rd = (String)request.getSession().getAttribute("rd");
if(rd!=null&¶mId.equals(rd)){
request.setAttribute("url", MemberURLConst.URL_PWD_MODIFY);
return new ModelAndView(MemberURLConst.URL_BASE);
}
if(null==currentUser) {
return new ModelAndView("error");
}
String orignalPasswd = request.getParameter("orignalPasswd");
User authuser = userCardService.auth(new User(currentUser.getUsername(),orignalPasswd));
if(authuser==null){
request.setAttribute("url", MemberURLConst.URL_PWD_MODIFY);
request.setAttribute("errmsg", "原始密码不正确");
if (currentUser.getUsertype() != User.USER_TYPE_NORMAL) {
return new ModelAndView("/management/member/member_pwdmodify");
}else{
return new ModelAndView(MemberURLConst.URL_BASE);
}
}
String confirmPasswd = request.getParameter("confirmPasswd");
String newPwd = EncryptUtil.toMD5(confirmPasswd);
if(null!=newPwd){
newPwd = newPwd.toUpperCase();
}
authuser.setPassword(newPwd);
try{
userCardService.updateUser(authuser);
}catch (Exception e) {
e.printStackTrace();
request.setAttribute("errmsg", "密码修改失败");
request.setAttribute("url", MemberURLConst.URL_PWD_MODIFY);
if (currentUser.getUsertype() != User.USER_TYPE_NORMAL) {
return new ModelAndView("/management/member/member_pwdmodify");
}else{
return new ModelAndView(MemberURLConst.URL_BASE);
}
}
RunTimeUser.getRunTimeUser(request).updateUser(authuser);
if (currentUser.getUsertype() != User.USER_TYPE_NORMAL) {
return new ModelAndView("/management/member/member_pwdmodify");
}
request.setAttribute("url", MemberURLConst.URL_PWD_MODIFY);
request.setAttribute("errmsg", "密码修改成功");
return new ModelAndView(MemberURLConst.URL_BASE);