1 23 24 package org.infoglue.cms.applications.managementtool.actions; 25 26 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction; 27 import org.infoglue.cms.controllers.kernel.impl.simple.UserControllerProxy; 28 import org.infoglue.cms.exception.ConstraintException; 29 import org.infoglue.cms.exception.SystemException; 30 import org.infoglue.cms.util.CmsPropertyHandler; 31 32 import webwork.action.Action; 33 import webwork.action.ActionContext; 34 35 40 41 public class UpdateSystemUserPasswordAction extends InfoGlueAbstractAction 42 { 43 private String userName; 44 private String oldPassword; 45 private String newPassword; 46 private String verifiedNewPassword; 47 private String returnAddress; 48 49 public String doInput() throws Exception 50 { 51 return Action.INPUT; 52 } 53 54 public String doInputStandalone() throws Exception 55 { 56 return "inputStandalone"; 57 } 58 59 protected String doExecute() throws Exception 60 { 61 if(userName.equals(CmsPropertyHandler.getAnonymousUser())) 62 throw new SystemException("You must not change password on this user as it's needed by the system."); 63 64 if(!newPassword.equals(verifiedNewPassword)) 65 throw new ConstraintException("SystemUser.newPassword", "309"); 66 67 UserControllerProxy.getController().updateUserPassword(this.userName, this.oldPassword, this.newPassword); 68 69 if(this.returnAddress != null && !this.returnAddress.equalsIgnoreCase("")) 70 { 71 ActionContext.getResponse().sendRedirect(returnAddress); 72 return Action.NONE; 73 } 74 else 75 return Action.SUCCESS; 76 } 77 78 public String getNewPassword() 79 { 80 return newPassword; 81 } 82 83 public void setNewPassword(String newPassword) 84 { 85 this.newPassword = newPassword; 86 } 87 88 public String getOldPassword() 89 { 90 return oldPassword; 91 } 92 93 public void setOldPassword(String oldPassword) 94 { 95 this.oldPassword = oldPassword; 96 } 97 98 public String getUserName() 99 { 100 return userName; 101 } 102 103 public void setUserName(String userName) 104 { 105 this.userName = userName; 106 } 107 108 public String getVerifiedNewPassword() 109 { 110 return verifiedNewPassword; 111 } 112 113 public void setVerifiedNewPassword(String verifiedNewPassword) 114 { 115 this.verifiedNewPassword = verifiedNewPassword; 116 } 117 118 public String getReturnAddress() 119 { 120 return returnAddress; 121 } 122 123 public void setReturnAddress(String returnAddress) 124 { 125 this.returnAddress = returnAddress; 126 } 127 } 128 | Popular Tags |