📄 cpasswd.java
字号:
package com.laoer.bbscs.web.action;
import com.laoer.bbscs.web.form.*;
import com.laoer.bbscs.web.servlet.*;
import com.laoer.bbscs.bean.*;
import com.laoer.comm.util.*;
import com.laoer.bbscs.sys.*;
import org.apache.struts.action.*;
import javax.servlet.http.*;
/**
* <p>Title: TianYi BBS</p>
* <p>Description: TianYi BBS System</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: LAOER.COM/TIANYISOFT.NET</p>
* @author laoer
* @version 6.0
*/
public class Cpasswd
extends BaseAction {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
ActionErrors errors = new ActionErrors();
CpasswdForm form = (CpasswdForm) actionForm;
UserCheck uc = this.getUserCheck(httpServletRequest, httpServletResponse);
if (uc.isGuest()) {
errors.add("error.pleaselogin", new ActionError("error.pleaselogin"));
saveErrors(httpServletRequest, errors);
LoginForm loginForm = new LoginForm();
loginForm.setTourl(SysUtil.getToURL(httpServletRequest,
"cpasswd" + Constant.FILEPREFIX));
/*
loginForm.setTourl(SysUtil.encodeURL("cpasswd" + Constant.FILEPREFIX,
Constant.CHARSET));*/
httpServletRequest.setAttribute("loginForm", loginForm);
//return actionMapping.findForward("login");
return SysUtil.getPassLogin(actionMapping);
}
if (form.getAction().equals("show")) {
if (SysInfo.getInstance().getUsepass().equals("y")) {
ActionForward f = new ActionForward(SysInfo.getInstance().
getPasschangeurl(), true);
return f;
}
else {
form.setAction("changepass");
httpServletRequest.setAttribute("cpasswdForm", form);
return actionMapping.findForward("cpasswd");
}
}
if (form.getAction().equals("changepass")) {
UserInfo ui = getUserCache().getUserInfoFromCache(uc.getId());
if (ui == null) {
errors.add("error.getusererror", new ActionError("error.getusererror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
String op = Util.hash(form.getOldpasswd());
if (!op.equals(ui.getRepasswd())) {
errors.add("error.changepasswdold",
new ActionError("error.changepasswdold"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
ui.setPasswd(form.getNewpasswd1());
ui.setRepasswd(Util.hash(form.getNewpasswd1()));
ui = getUserInfoService().saveUserInfo(ui);
if (ui == null) {
errors.add("error.passwdchange",
new ActionError("error.passwdchange"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
getUserCache().putUserInfoInCache(ui);
ActionForward f = new ActionForward(SysUtil.getResultUrl(
"succeed.changepasswd", "in" + Constant.FILEPREFIX), true);
return f;
}
return actionMapping.findForward("error");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -