1 25 26 package net.killingar.forum.actions; 27 28 public class SetPassword 29 extends ActionForumSupport 30 { 31 String 33 username = "", 34 newPasswordKey = "", 35 newpassword, newpassword2; 36 37 39 public void setUsername(String username) { this.username = username; } 41 public void setNewPasswordKey(String in) { newPasswordKey = in; } 42 public void setNewpassword(String in) { newpassword = in; } 43 public void setNewpassword2(String in) { newpassword2 = in; } 44 45 public String getUsername() { return username; } 47 public String getNewPasswordKey() { return newPasswordKey; } 48 public String getUrl() { return "/"; } 49 50 protected void doValidation() 52 { 53 super.doValidation(); 54 55 if (newpassword != null && !newpassword.equals(newpassword2)) 56 addError("newpassword2", "passwords do not match"); 57 } 58 59 protected String doExecute() 60 { 61 try 62 { 63 if (username.equals("") || newPasswordKey.equals("")) 64 return INPUT; 65 66 manager.setNewPassword(username, newpassword, newPasswordKey); 67 68 manager.login(username, newpassword); 69 70 return SUCCESS; 71 } 72 catch (Exception e) 73 { 74 addErrorMessage("login failed, exception thrown ("+e.toString()+")"); 75 e.printStackTrace(); 76 return ERROR; 77 } 78 } 79 } | Popular Tags |