Changeset 3716 in main
- Timestamp:
- 04/14/12 03:01:36 (10 years ago)
- Location:
- trunk/src/main
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/org/ibisph/user/modelmap/AbstractUserStatus.java
r3715 r3716 3 3 import java.util.Date; 4 4 5 import org.dom4j.Document; 5 6 import org.dom4j.Element; 6 7 … … 9 10 import org.ibisph.web.servlet.AWTCaptchaServlet; 10 11 11 12 12 /** 13 * Processes a submitted user registration13 * Core definitions that the status type model maps extend from. 14 14 * 15 15 * @author Garth Braithwaite, STG … … 18 18 protected static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractUserStatus.class); 19 19 20 // user status values that the status view page keys off of. 20 21 public static final String NO_USER_ID_STATUS = "INVALID_USER_ID"; 21 22 public static final String USER_DOES_NOT_EXIST_STATUS = "USER_DOES_NOT_EXIST"; … … 35 36 36 37 38 public void setCaptchaSessionName(String captchaSessionName) { 39 this.captchaSessionName = captchaSessionName; 40 } 37 41 public void setUserProfileModelMapKey(String userProfileModelMapKey) { 38 42 this.userProfileModelMapKey = userProfileModelMapKey; … … 45 49 /** 46 50 * Localizes setting of the user profile status. 47 * @param userProfile Element48 * @param status Code51 * @param userProfileDocument 52 * @param status 49 53 */ 50 protected void setStatus( Element userProfileElement, String statusCode) {51 Element status CodeElement = XMLLib.newElement("STATUS", statusCode);52 Element dateElement 53 XMLLib.replaceElement(userProfile Element, statusCodeElement);54 XMLLib.replaceElement(userProfile Element, dateElement);54 protected void setStatus(Document userProfileDocument, String status) { 55 Element statusElement = XMLLib.newElement("STATUS", status); 56 Element dateElement = XMLLib.newElement("UPDATED_DTS", (new Date()).toString()); 57 XMLLib.replaceElement(userProfileDocument.getRootElement(), statusElement); 58 XMLLib.replaceElement(userProfileDocument.getRootElement(), dateElement); 55 59 } //-------------------------- End of Method ------------------------------ 56 60 -
trunk/src/main/java/org/ibisph/user/modelmap/ProcessUserRegistration.java
r3715 r3716 17 17 18 18 /** 19 * Processes a submitted user registration 19 * Processes a submitted new user registration. Various tests are performed 20 * with a user XML model being returned. The status page view uses the user's 21 * status to determine which message to show the user. If all goes well the 22 * verification email is sent and the user's XML is saved. 20 23 * 21 24 * @author Garth Braithwaite, STG … … 70 73 Element userProfileElement = (Element)modelMap.get(this.userProfileModelMapKey); 71 74 72 // the xslt parameter can't deal with Element objects - convert to document. 75 // The status page uses the user XML as a model to determine which message 76 // to show. So, for the first set of status codes need to have a user doc. 77 // as the XSLT only deals with documents - can't handle elements. 73 78 Document userProfileDocument = XMLLib.newDocument(userProfileElement); 74 79 modelMap.put(this.userProfileModelMapKey, userProfileDocument); … … 77 82 if(!StrLib.isSomething(id)) { 78 83 logger.warn(".processModelMap - NO USER ID. User's IP: {}", request.getRemoteAddr()); 79 setStatus(userProfile Element, AbstractUserStatus.NO_USER_ID_STATUS);84 setStatus(userProfileDocument, AbstractUserStatus.NO_USER_ID_STATUS); 80 85 return; 81 86 } … … 85 90 if(null != userProfile) { 86 91 logger.warn(".processModelMap - USER ALREADY EXISTS. User's ID: {}, User's IP: {}", id, request.getRemoteAddr()); 87 setStatus(userProfile Element, AbstractUserStatus.USER_PROFILE_EXISTS_STATUS);92 setStatus(userProfileDocument, AbstractUserStatus.USER_PROFILE_EXISTS_STATUS); 88 93 return; 89 94 } … … 94 99 if((null == userSessionCaptcha) || (null == userProfileCaptcha) || !userProfileCaptcha.equals(userSessionCaptcha)) { 95 100 logger.info(".processModelMap - INVALID CAPTCHA. User's ID: {}, User's IP: {}", id, request.getRemoteAddr()); 96 setStatus(userProfile Element, AbstractUserStatus.INVALID_CAPTCHA_STATUS);101 setStatus(userProfileDocument, AbstractUserStatus.INVALID_CAPTCHA_STATUS); 97 102 return; 98 103 } 99 104 100 // send the verification email message and set status accordingly.101 105 String emailAddress = XMLLib.getText(userProfileElement, "EMAIL_ADDRESS"); 102 106 if(!StrLib.isSomething(emailAddress)) { 103 107 logger.warn(".processModelMap - MISSING EMAIL ADDRESS, User's IP: {}", request.getRemoteAddr()); 104 setStatus(userProfile Element, AbstractUserStatus.INVALID_EMAIL_ADDRESS_STATUS);108 setStatus(userProfileDocument, AbstractUserStatus.INVALID_EMAIL_ADDRESS_STATUS); 105 109 return; 106 110 } 107 111 112 // If here then so far so good - send the verification email message and 113 // set status accordingly. 108 114 String verificationValue = request.getSession().getId(); 109 if(sendVerificationEmail(request, userProfile Element, id, emailAddress, verificationValue)) {115 if(sendVerificationEmail(request, userProfileDocument, id, emailAddress, verificationValue)) { 110 116 // if here then all was normal. set the status code. 111 117 Element verificationElement = XMLLib.newElement("VERIFICATION", verificationValue); 112 XMLLib.replaceElement(userProfileElement, verificationElement); 113 setStatus(userProfileElement, AbstractUserStatus.VERIFICATION_EMAIL_SENT_STATUS); 118 XMLLib.replaceElement(userProfileDocument.getRootElement(), verificationElement); 114 119 this.userProfileService.saveUser(userProfileDocument); 115 120 } … … 121 126 * Localized code for sending the verification email. 122 127 * @param request 123 * @param userProfile Element128 * @param userProfileDocument 124 129 * @param id 125 130 * @param emailAddress … … 129 134 protected boolean sendVerificationEmail( 130 135 HttpServletRequest request, 131 Element userProfileElement,136 Document userProfileDocument, 132 137 String id, 133 138 String emailAddress, … … 157 162 catch(AddressException ae) { 158 163 logger.warn(".processModelMap - Email Address error, Address: {}", emailAddress); 159 setStatus(userProfile Element, AbstractUserStatus.INVALID_EMAIL_ADDRESS_STATUS);164 setStatus(userProfileDocument, AbstractUserStatus.INVALID_EMAIL_ADDRESS_STATUS); 160 165 return(false); 161 166 } 162 167 catch(Exception e) { 163 168 logger.error(".processModelMap - General Email Error. Address: {}", emailAddress, e); 164 setStatus(userProfile Element, AbstractUserStatus.EMAIL_ERROR_STATUS);169 setStatus(userProfileDocument, AbstractUserStatus.EMAIL_ERROR_STATUS); 165 170 return(false); 166 171 } 167 172 173 setStatus(userProfileDocument, AbstractUserStatus.VERIFICATION_EMAIL_SENT_STATUS); 168 174 return(true); 169 } //-------------------------- End of Method ------------------------------ 170 175 } //-------------------------- End of Method ------------------------------ 171 176 172 177 } //============================ END OF CLASS ================================= -
trunk/src/main/java/org/ibisph/user/modelmap/SendAccess.java
r3715 r3716 16 16 17 17 /** 18 * Processes the send password or verification email.18 * Processes the send password or send verification email. 19 19 * 20 20 * @author Garth Braithwaite, STG … … 33 33 34 34 /** 35 * returns a user profile document with an appropriate message string. 35 * Modify's the user profile document with an appropriate message string. 36 * Note that this code does NOT save any user XML - it simply reads the 37 * content and sets an internal memory model for the status page. 36 38 * 37 39 * @param request HttpServletRequest . … … 41 43 Element userProfileElement = (Element)modelMap.get(this.userProfileModelMapKey); 42 44 43 // the xslt parameter can't deal with Element objects - convert to document. 45 // The status page uses the user XML as a model to determine which message 46 // to show. So, for the first set of status codes need to have a user doc. 47 // as the XSLT only deals with documents - can't handle elements. 44 48 Document userProfileDocument = XMLLib.newDocument(userProfileElement); 45 49 modelMap.put(this.userProfileModelMapKey, userProfileDocument); … … 47 51 String id = XMLLib.getText(userProfileElement, "ID"); 48 52 if(!StrLib.isSomething(id)) { 49 setStatus(userProfile Element, AbstractUserStatus.NO_USER_ID_STATUS);53 setStatus(userProfileDocument, AbstractUserStatus.NO_USER_ID_STATUS); 50 54 return; 51 55 } … … 56 60 if((null == userSessionCaptcha) || (null == userProfileCaptcha) || !userProfileCaptcha.equals(userSessionCaptcha)) { 57 61 logger.info(".processModelMap - INVALID CAPTCHA. User's ID: {}, User's IP: {}", id, request.getRemoteAddr()); 58 setStatus(userProfile Element, AbstractUserStatus.INVALID_CAPTCHA_STATUS);62 setStatus(userProfileDocument, AbstractUserStatus.INVALID_CAPTCHA_STATUS); 59 63 return; 60 64 } 61 65 62 66 // check to see if user profile exists. If not return message. 63 Document userProfile = this.userProfileService.getUser(id); 64 if(null == userProfile) { 67 userProfileDocument = this.userProfileService.getUser(id); 68 modelMap.put(this.userProfileModelMapKey, userProfileDocument); 69 if(null == userProfileDocument) { 70 userProfileDocument = XMLLib.newDocument(userProfileElement); 71 modelMap.put(this.userProfileModelMapKey, userProfileDocument); 65 72 logger.warn(".processModelMap - USER DOES NOT EXIST. User's ID: {}, User's IP: {}", id, request.getRemoteAddr()); 66 setStatus(userProfile Element, AbstractUserStatus.USER_DOES_NOT_EXIST_STATUS);73 setStatus(userProfileDocument, AbstractUserStatus.USER_DOES_NOT_EXIST_STATUS); 67 74 return; 68 75 } … … 70 77 // if here then check the status. If verified then send the password else 71 78 // send the verify email. 72 userProfileElement = userProfile.getRootElement(); 73 String userStatus = XMLLib.getText(userProfileElement, "STATUS"); 74 String emailAddress = XMLLib.getText(userProfileElement, "EMAIL_ADDRESS"); 79 String userStatus = XMLLib.getText(userProfileDocument, "/USER/STATUS"); 80 String emailAddress = XMLLib.getText(userProfileDocument, "/USER/EMAIL_ADDRESS"); 75 81 if(AbstractUserStatus.REGISTRATION_VERIFIED_STATUS.equals(userStatus)) { 76 String password = XMLLib.getText(userProfile Element, "PASSWORD");82 String password = XMLLib.getText(userProfileDocument, "/USER/PASSWORD"); 77 83 try { 78 84 emailPasswordService.sendMergedEmailMessage( … … 83 89 catch(AddressException ae) { 84 90 logger.warn(".processModelMap - Email Address error, Address: {}", emailAddress); 85 setStatus(userProfile Element, AbstractUserStatus.INVALID_EMAIL_ADDRESS_STATUS);91 setStatus(userProfileDocument, AbstractUserStatus.INVALID_EMAIL_ADDRESS_STATUS); 86 92 return; 87 93 } 88 94 catch(Exception e) { 89 95 logger.error(".processModelMap - General Email Error. Address: {}", emailAddress, e); 90 setStatus(userProfile Element, AbstractUserStatus.EMAIL_ERROR_STATUS);96 setStatus(userProfileDocument, AbstractUserStatus.EMAIL_ERROR_STATUS); 91 97 return; 92 98 } 93 99 94 100 logger.info(".processModelMap - PASSWORD EMAILED. Email Address: {}, User's IP: {}", emailAddress, request.getRemoteAddr()); 95 setStatus(userProfile Element, AbstractUserStatus.PASSWORD_EMAIL_SENT_STATUS);101 setStatus(userProfileDocument, AbstractUserStatus.PASSWORD_EMAIL_SENT_STATUS); 96 102 } 97 103 98 104 // else send the verification 99 105 else { 100 String verificationValue = XMLLib.getText(userProfileElement, "VERIFICATION"); 101 sendVerificationEmail(request, userProfileElement, id, emailAddress, verificationValue); 102 setStatus(userProfileElement, AbstractUserStatus.VERIFICATION_EMAIL_SENT_STATUS); 106 String verificationValue = XMLLib.getText(userProfileDocument, "/USER/VERIFICATION"); 107 sendVerificationEmail(request, userProfileDocument, id, emailAddress, verificationValue); 103 108 } 104 109 -
trunk/src/main/java/org/ibisph/user/modelmap/VerifyUserRegistration.java
r3715 r3716 7 7 8 8 import org.dom4j.Document; 9 import org.dom4j.Element;10 9 11 10 import org.ibisph.modelmap.GetModelMapFromHTTPRequest; … … 16 15 17 16 /** 18 * Checks the verification email and sets the user's status to VERIFIED if matches. 17 * Verification email response handler. Sets the user's XML status to VERIFIED 18 * if matches and to appropriate value if an issue exists. The model is the 19 * user XML that the status page keys off of. 19 20 * 20 21 * @author Garth Braithwaite, STG … … 24 25 //------------------------ M A I N R E Q U E S T M O D E L M E T H O D 25 26 /** 26 * returns appropriate message string for the new registration. 27 * Checks the user's verification value against the value from the request 28 * URL. Returns a user XML document which has an appropriate status value 29 * that the status page will key off of. The request URL is of the form: 30 * verify/user/registration/braithwaitegarth%40msn.com/C162EB04DFF67A5850B32DFC104865BB 27 31 * 28 32 * @param request HttpServletRequest . … … 30 34 */ 31 35 public Map<String, Object> getModelMap(HttpServletRequest request) throws Exception { 32 // verify/user/registration/braithwaitegarth%40msn.com/C162EB04DFF67A5850B32DFC104865BB33 36 String requestVerificationValue = IOPath.getFilename(request.getPathInfo()); 34 37 String path = IOPath.getPath(request.getPathInfo()); 35 38 String userID = IOPath.getFilename(path); 36 39 Document userProfileDocument = this.userProfileService.getUser(userID); 37 Element userElement = userProfileDocument.getRootElement(); 38 String userVerificationValue = XMLLib.getText(userElement, "VERIFICATION"); 40 String userVerificationValue = XMLLib.getText(userProfileDocument, "/USER/VERIFICATION"); 39 41 40 42 if(!StrLib.isSomething(userID)) { 41 43 logger.error(".processModelMap - INVALID USER ID. User's IP: {}", request.getRemoteAddr()); 42 userElement = XMLLib.newElement("USER"); 43 userProfileDocument = XMLLib.newDocument(userElement); 44 setStatus(userElement, AbstractUserStatus.NO_USER_ID_STATUS); 44 userProfileDocument = XMLLib.newDocument(XMLLib.newElement("USER")); 45 setStatus(userProfileDocument, AbstractUserStatus.NO_USER_ID_STATUS); 45 46 } 46 47 47 48 else if((null == requestVerificationValue) || (null == userVerificationValue) || !requestVerificationValue.equals(userVerificationValue)) { 48 49 logger.error(".processModelMap - INVALID VERFICATION. Email Address: {}, User's IP: {}", userID, request.getRemoteAddr()); 49 setStatus(user Element, AbstractUserStatus.INVALID_VERIFICATION_STATUS);50 setStatus(userProfileDocument, AbstractUserStatus.INVALID_VERIFICATION_STATUS); 50 51 } 51 52 52 53 else { 53 54 // if here then verified. set the status, save the user, and return. 54 setStatus(user Element, AbstractUserStatus.REGISTRATION_VERIFIED_STATUS);55 setStatus(userProfileDocument, AbstractUserStatus.REGISTRATION_VERIFIED_STATUS); 55 56 this.userProfileService.saveUser(userProfileDocument); 56 57 } -
trunk/src/main/java/org/ibisph/user/service/EmailAccountAccess.java
r3715 r3716 12 12 13 13 /** 14 * Sends a simple merged valueEmail message to an address.14 * Sends a HTML or merged value HTEML Email message to an address. 15 15 * 16 16 * @author Garth Braithwaite, STG -
trunk/src/main/webapps/ibisph-view/WEB-INF/config/spring/user.xml
r3715 r3716 227 227 228 228 <h2>Password: [Password_SearchReplaceSignature]</h2> 229 <br/> <br/>230 231 If you did NOT register for an account or i syou did not232 request your password to be emailed to you please report233 thisto the system administrator.229 <br/> 230 231 If you did NOT register for an account or if you did not 232 request this password reminder email please report this 233 potential security issue to the system administrator. 234 234 </body> 235 235 </html> -
trunk/src/main/webapps/ibisph-view/WEB-INF/jsp/access_denied.jsp
r3715 r3716 60 60 A problem was encountered while trying to access the application. 61 61 Possible Reasons: 62 <hr/>63 62 <ul> 64 63 <li>Invalid login credentials (username and/or password)</li> -
trunk/src/main/webapps/ibisph-view/xml/user/html_content/Status.xml
r3715 r3716 92 92 be shown a "Verified" message. You will then be able to login to 93 93 your account using your email and the password you specified. Once 94 logged in you can then create saved query definitions and query 95 criteria. 94 logged in you can create saved query definitions and query criteria. 96 95 <br/><br/> 97 96 … … 99 98 check you junk email folder. If you still do not get a message 100 99 you should check with your email provider to make sure that they 101 are not screening the email as junk. If you would like your100 are not filtering the email as junk. If you would like your 102 101 verification email sent again please visit the <a ibis:href="user/AccountAccess.html">Account 103 102 Access</a> page. … … 139 138 <ibis:ContiditionalSection id="VERIFIED"> 140 139 <h2>Account Verified and Active</h2> 140 You have successfully verified and activated your IBIS-PH user account. 141 You can now save query dataset definitions and criteria definitions. 142 You can login to your account at the time of saving your definition 143 or you can login now via the <a ibis:href="user/Login.html">User Login</a> 144 page. 145 <br/><br/> 146 147 If you have forgotten your password please visit the <a ibis:href="user/AccountAccess.html">Account 148 Access</a> page. If you have concerns about your account please 149 contact this application's system administrator. 141 150 </ibis:ContiditionalSection> 142 151 … … 145 154 An email has been sent to your email address that contains your 146 155 password. Please wait a few seconds then check your inbox. If 147 you do NOT receive a password email message please check you junk156 you do NOT receive a password email message, please check you junk 148 157 email folder. If you still do not get a message you should check 149 with your email provider to make sure that they are not screening150 the email as junk.158 with your email provider to make sure that they are not filtering 159 out email messages from us. 151 160 <br/><br/> 152 161
Note: See TracChangeset
for help on using the changeset viewer.