Author: taylor Date: Wed Nov 30 11:19:37 2005 New Revision: 350025 URL: http://svn.apache.org/viewcvs?rev=350025&view=rev Log: handle dynamic portal URL in Registration portlet
Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java?rev=350025&r1=350024&r2=350025&view=diff ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java (original) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java Wed Nov 30 11:19:37 2005 @@ -30,6 +30,7 @@ import javax.portlet.PortletConfig; import javax.portlet.PortletException; import javax.portlet.PortletRequest; +import javax.portlet.PortletResponse; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; @@ -179,6 +180,8 @@ // just to be sure this.optionForceEmailsToBeSystemUnique = true; } + this.returnUrlPath = config.getInitParameter(IP_RETURN_URL); + this.redirectPath = config.getInitParameter(IP_REDIRECT_PATH); } public void doView(RenderRequest request, RenderResponse response) @@ -374,13 +377,15 @@ { String password = admin.generatePassword(); userInfo.put("user.password", password); - } else + } + else { if (userInfo.get("password").equals( userInfo.get("verifyPassword"))) { - } else + } + else { // TODO: localize messages errors @@ -389,7 +394,8 @@ return; } } - } catch (Exception e) + } + catch (Exception e) { // TODO: localize messages errors.add("Failed to add user. " + e.toString()); @@ -416,8 +422,10 @@ userInfo.put(CTX_RETURN_URL, generateReturnURL(actionRequest, actionResponse, urlGUID)); - if (this.emailTemplate == null) { throw new Exception( - "email template not available"); } + if (this.emailTemplate == null) + { + throw new Exception("email template not available"); + } admin.sendEmail(getPortletConfig(), (String) userInfo .get(USER_ATTRIBUTE_EMAIL), getEmailSubject(actionRequest), @@ -426,9 +434,10 @@ publishRenderMessage(actionRequest, MSG_REGED_USER_MSG, "You have completed the user registration process. Please login above"); - actionResponse.sendRedirect(this.redirectPath); + actionResponse.sendRedirect(this.generateRedirectURL(actionRequest, actionResponse)); - } catch (Exception e) + } + catch (Exception e) { // TODO: localize messages errors.add("Failed to add user. " + e.toString()); @@ -464,10 +473,20 @@ return Arrays.asList(temps); } - protected String generateReturnURL(ActionRequest request, - ActionResponse response, String urlGUID) + protected String generateReturnURL(PortletRequest request, + PortletResponse response, + String urlGUID) { - return this.returnUrlPath + "?newUserGUID=" + urlGUID; + String fullPath = this.returnUrlPath + "?newUserGUID=" + urlGUID; + // NOTE: getPortalURL will encode the fullPath for us + String url = admin.getPortalURL(request, response, fullPath); + return url; } + protected String generateRedirectURL(PortletRequest request, + PortletResponse response) + { + return admin.getPortalURL(request, response, this.redirectPath); + } + } Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml?rev=350025&r1=350024&r2=350025&view=diff ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml (original) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml Wed Nov 30 11:19:37 2005 @@ -853,7 +853,7 @@ <init-param> <description>This parameter sets the url to which folks will return after they receive an email</description> <name>returnURL</name> - <value>/complete-registration.psml</value> + <value>/</value> </init-param> <init-param> <description>This parameter sets the URL to which people will go after they successfully complete their form for forgotten password</description> @@ -924,6 +924,17 @@ <name>Option_Use_Email_As_Username</name> <value>false</value> </init-param> + + <init-param> + <description>This parameter sets the url to which folks will return after they receive an email</description> + <name>returnURL</name> + <value>/complete-registration.psml</value> + </init-param> + <init-param> + <description>This parameter sets the URL to which people will go after they successfully complete their form for forgotten password</description> + <name>redirectPath</name> + <value>/registration-reminder.psml</value> + </init-param> <init-param> <description>This is the template in which you setup an email to be sent after user exists</description> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]