package com.javaeye.jert.action.user.profile;
import com.javaeye.jert.action.user.BaseUserAction;
import com.javaeye.user.User;
import com.javaeye.user.UserManager;
import com.javaeye.user.util.RemoteUser;
/**
* @author firebody
* @since 2005-1-17
* @version $Revision: 1.2 $
*/
public class ChangeUserPassword extends BaseUserAction {
private UserManager userManager;
private String verifyPassword;
private String oldPassword;
private String newPassword;
public String execute() throws Exception {
User user = RemoteUser.get();
if (!user.authenticate(oldPassword)) {
addFieldError("oldPassword", getText("password.NotCorrect"));
return INPUT;
}
user.setPassword(newPassword);
userManager.store(user);
return SUCCESS;
}
public String view() {
return SUCCESS;
}
public String getNewPassword() {
return newPassword;
}
public String getOldPassword() {
return oldPassword;
}
public String getVerifyPassword() {
return verifyPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
public void setOldPassword(String oldPassword) {
this.oldPassword = oldPassword;
}
public void setVerifyPassword(String verifyPassword) {
this.verifyPassword = verifyPassword;
}
public void setUserManager(UserManager userManager) {
this.userManager = userManager;
}
}