📄 clearpasswordaction.java
字号:
/*
* Created on 2004-8-31
*
*/
package com.esimple.service.rbac.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import com.esimple.framework.web.action.BaseForm;
import com.esimple.framework.web.action.IbatisSupportAction;
import com.esimple.service.crypto.PasswordTool;
import com.esimple.service.rbac.po.Operator;
/**
* @author steven
*
*/
public class ClearPasswordAction extends IbatisSupportAction {
protected String execute(
BaseForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
String userid = form.getValueAsString("userid",true);
String password = form.getValueAsString("password",true);
if(userid==null && password== null){
return this.FORWARD_SUCCESS;
}
String newPass = PasswordTool.encrypt(password);
Object obj = getSqlMapDao().load("rbac.user.getUser",userid);
if( obj != null) {
Operator oper =(Operator)obj;
oper.setPassword(newPass);
getSqlMapDao().update("rbac.user.setNewPassword",oper);
return this.alert(request, "common.success");
}else{
ActionErrors errors = new ActionErrors();
errors.add( ActionErrors.GLOBAL_ERROR,
new ActionError("error.rbac.user.notExist"));
saveErrors(request, errors);
return this.FORWARD_SUCCESS;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -