Fórum

after create account

Cesar William, modificado 13 Anos atrás.

after create account

Junior Member Postagens: 34 Data de Entrada: 07/06/10 Postagens Recentes
Hi,
Is there a configurable way to change the landing page after of "Create Account"? Or pass to "Create Account" page some parameter?
Jen Fong, modificado 13 Anos atrás.

RE: after create account

New Member Postagens: 10 Data de Entrada: 20/05/10 Postagens Recentes
Hi, Cesar--

Did you ever figure this out? We also would like to change the landing page after first login or after account creation, but not for all logins.

We were hoping to avoid the ext environment but what I've been reading is that we may have to end up changing the CreateAccountAction to add a redirect...
thumbnail
Amos Fong, modificado 13 Anos atrás.

RE: after create account

Liferay Legend Postagens: 2047 Data de Entrada: 07/10/08 Postagens Recentes
If you are running 6.0.x or 5.2 EE (I don't remember which service pack) you can pass in a redirect parameter. Otherwise you'll need ext to for createAccountAction to send the redirect. You may want to do it similar to trunk right now so when you upgrade you can get rid of your ext class. This is how it's done in trunk:

	protected void sendRedirect(
			ActionRequest actionRequest, ActionResponse actionResponse,
			ThemeDisplay themeDisplay, String login, String password)
		throws Exception {

		HttpServletRequest request = PortalUtil.getHttpServletRequest(
			actionRequest);

		String redirect = PortalUtil.escapeRedirect(
			ParamUtil.getString(actionRequest, "redirect"));

		if (Validator.isNotNull(redirect)) {
			redirect = PortalUtil.escapeRedirect(redirect);

			HttpServletResponse response = PortalUtil.getHttpServletResponse(
				actionResponse);

			LoginUtil.login(request, response, login, password, false, null);
		}
		else {
			PortletURL loginURL = LoginUtil.getLoginURL(
				request, themeDisplay.getPlid());

			loginURL.setParameter("login", login);

			redirect = loginURL.toString();
		}

		actionResponse.sendRedirect(redirect);
	}
Jen Fong, modificado 13 Anos atrás.

RE: after create account

New Member Postagens: 10 Data de Entrada: 20/05/10 Postagens Recentes
Thanks, Amos!

We decided to not muck about with the ext environment [mostly because we dont' really know how to make use of it properly ... ] and just modify the notification e-mail to contain the information that would have been in the redierct page.

We are currently using 5.2.3 CE so we would indeed have needed EXT.

However, for future reference if we were to override the CreateAccountAction in the ext environment, I had a few ?s:
1) to override the action, would we would simply copy the same code into our own class and modify, then change struts-config.xml

<action path="/login/create_account" [color="#F81C1C]type=&quot;my.package.NewCreateAccountAction&quot;[/color]">
                        <forward name="portlet.login.create_account" path="portlet.login.create_account" />
                </action>

??

2)Currently, CreateAccountAction calls the helper addUser function and then redirects in processAction like so:

 String redirect = PortalUtil.getLayoutURL(layout, themeDisplay);
 sendRedirect(actionRequest, actionResponse, redirect);



Would we simply have to add a "redirect" param to the create_account.jsp and use this in our own processAction instead of the getLayoutURL in this sendRedirect line, or would we have to additionally redefine sendRedirect as you mentioned in your post?

Thank you for your helpful "minimizing the ext environment" blog, also. This helped us see that we would just extend the createaccountaction, but we are still slightly confused--would redefining sendRedirect like you mentioned be sufficient in our class or would we also need to redefine processAction?

I apologize for these simple questions; we aren't exactly sure how the ext environment works but hope we have the general gist of: create new class that extends original, modify, deploy ext-impl, modify configs to point to new ext classes.

Thanks again for your quick reply. We were on zope 2 before which has long been dead; it's so nice to have such an immediate developer and community response with liferay!
thumbnail
Amos Fong, modificado 13 Anos atrás.

RE: after create account

Liferay Legend Postagens: 2047 Data de Entrada: 07/10/08 Postagens Recentes
Hi Jen,

If you are just starting on Liferay, I suggest going with 6.0 (which should be released soon...hopefully emoticon). But If you decide to go with 5.2.3:

1) to override the action, would we would simply copy the same code into our own class and modify, then change struts-config.xml


Correct, actually it should be struts-config-ext.xml, but it doesn't work in 5.2.3 (see http://issues.liferay.com/browse/LPS-6877). So yes, overwrite struts-config.xml with your own class.

Your class should extend CreateAccountAction.java so you just overwrite the one method you need.
is this sendRedirect directly in the CreateAccountAction class?]


Yes, but I don't think it exists in 5.2.3 so you should just override AddUser().

I apologize for these simple questions; we aren't exactly sure how the ext environment works but hope we have the general gist of: copy original source, modify, deploy ext-impl, modify configs to point to new ext classes.


No problem, it's always great to see new people. And yes you got the right gist of it.

Would we simply have to add a "redirect" param to the create_account.jsp and use this instead of the getLayoutURL in this sendRedirect line


Yea that would work.

[I was confused by the extra parameters


Do you mean the parameters used for this call?

LoginUtil.login(request, response, login, password, false, null);

I assume after they create an account and you want to redirect them, they should be logged in as well. So that's what that line of code does.