<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>User Id creation with an activation link email</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=25030241" />
  <subtitle>User Id creation with an activation link email</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=25030241</id>
  <updated>2026-04-05T08:34:40Z</updated>
  <dc:date>2026-04-05T08:34:40Z</dc:date>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25518015" />
    <author>
      <name>Vilmos Papp</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25518015</id>
    <updated>2013-06-10T13:56:09Z</updated>
    <published>2013-06-10T13:56:09Z</published>
    <summary type="html">Great &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif" &gt; I&amp;#39;m happy to hear that!</summary>
    <dc:creator>Vilmos Papp</dc:creator>
    <dc:date>2013-06-10T13:56:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25511442" />
    <author>
      <name>Subhasis Roy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25511442</id>
    <updated>2013-06-10T10:08:49Z</updated>
    <published>2013-06-10T10:08:49Z</published>
    <summary type="html">Yes Vil... &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif" &gt;</summary>
    <dc:creator>Subhasis Roy</dc:creator>
    <dc:date>2013-06-10T10:08:49Z</dc:date>
  </entry>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25506616" />
    <author>
      <name>Vilmos Papp</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25506616</id>
    <updated>2013-06-10T08:25:05Z</updated>
    <published>2013-06-10T08:25:05Z</published>
    <summary type="html">Hi,&lt;br /&gt;&lt;br /&gt;Does it mean that you managed to solve your problem?</summary>
    <dc:creator>Vilmos Papp</dc:creator>
    <dc:date>2013-06-10T08:25:05Z</dc:date>
  </entry>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25462666" />
    <author>
      <name>Subhasis Roy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25462666</id>
    <updated>2013-06-07T10:06:50Z</updated>
    <published>2013-06-07T10:06:50Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi,&lt;br&gt;&lt;br&gt;I am able to do it in Liferay Portal 6.0.5 CE.&lt;br&gt;&lt;br&gt;&lt;strong&gt;Steps followed:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;Step 1.  I have one registration.jsp file where user is giving input for registering himself.  I added the following code to create one actionURL in that jsp.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;portlet:actionurl var="activationLink"&amp;gt;
	&amp;lt;portlet:param name="&amp;lt;%= ActionRequest.ACTION_NAME %&amp;gt;" value="activationLink" /&amp;gt;
&amp;lt;/portlet:actionurl&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Step2:  Then I added one hidden field in the aui:form to pass that action url into processAction method.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;aui:form action="&amp;lt;%= registerUser %&amp;gt;" method="post" name="registerUserForm"&amp;gt;
         &amp;lt;aui:input name="activationLink" id="activationLink" type="hidden" value="&amp;lt;%=activationLink %&amp;gt;"&amp;gt;&amp;lt;/aui:input&amp;gt;
&amp;lt;/aui:form&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Step 3: Retrieved the &lt;em&gt;activationLink &lt;/em&gt;in the processAction method in the UserRegistration.java&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;String activationLink = ParamUtil.getString(actionRequest, "activationLink");&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Step 4:  Created the user and set the user status to deactive in my UserRegistration.java &lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;ThemeDisplay themeDisplay = (ThemeDisplay)map.get(Constant.THEME_DISPLAY);
Company company = themeDisplay.getCompany();
ServiceContext serviceContext = (ServiceContext)map.get(Constant.SERVICE_CONTEXT);

try {
		user = UserServiceUtil.addUser(
				 company.getCompanyId(), autoPassword, password1, password2,autoScreenName,screenName,
				 emailAddress, facebookId, openId, themeDisplay.getLocale(), firstName, middleName, lastName, prefixId,suffixId, male,                    
                                 birthdayMonth, birthdayDay, birthdayYear, jobTitle,groupIds, organizationIds, roleIds, userGroupIds, sendEmail,serviceContext);
} catch (Exception e) {
	         e.printStackTrace();
} 

if(user !=null ){
     //Setting user status to deactive
     UserLocalServiceUtil.updateActive(userId, false);
}&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Step 5: After creating user I am sending activation link to users.  This Activation link is nothing but the action url which we have generated previously (in the jsp).  I only appended user email address in that action url. So that when user will click that activation url in the mail, we will get the user email from the parameter.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;InternetAddress from = new InternetAddress("sender@gmail.com");
InternetAddress to = new InternetAddress(eMail);
String subject = "User successfully created";

StringBuffer sb = new StringBuffer();
sb.append(activationLink);
sb.append("&amp;amp;amp;eMail=");
sb.append(eMail);

String activateLink = sb.toString();
String mailBody = "&amp;lt;a href="+activateLink+"&amp;gt;Click on this link to activate your account&amp;lt;/a&amp;gt;";
MailEngine.send(from, to , subject , mailBody);
System.out.println("Email sent");&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;&lt;strong&gt;Sample Activation link in the user mail: &lt;/strong&gt;&lt;br&gt;&lt;em&gt;&amp;lt;a href=http://test.mysite.com/registration?p_auth=WLKMjft8&amp;amp;p_p_id=userregistration_WAR_UserRegistrationportlet_INSTANCE_ln7L&amp;amp;p_p_lifecycle=1&amp;amp;p_p_state=normal&amp;amp;p_p_mode=view&amp;amp;p_p_col_id=column-1&amp;amp;p_p_col_count=3&amp;amp;_userregistration_WAR_UserRegistrationportlet_INSTANCE_ln7L_javax.portlet.action=activationLink&amp;amp;eMail=receiver@gmail.com&amp;gt;Click on this link to activate your account&amp;lt;/a&amp;gt;&lt;/em&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Step 6:  Now  we have to create one "&lt;strong&gt;activationLink&lt;/strong&gt;" method in the UserRegistration.java .  When user will click the activation url in the email. Then this &lt;strong&gt;activationLink&lt;/strong&gt; method will get executed. In this method I have activated the user based on the email id received as parameter from the actionURL.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;public void activationLink(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PasswordException {
	System.out.println("in activation link method.....");
	
	String userEmail = (String)actionRequest.getParameter("eMail");
	User userObject=null;
	ThemeDisplay themeDisplayObj = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	try {
		userObject= UserLocalServiceUtil.getUserByEmailAddress(themeDisplayObj .getCompanyId(), userEmail);
	} catch (PortalException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (SystemException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	//Activating user
	if(objUser != null) {			

		try {
			UserLocalServiceUtil.updateActive(userObject.getUserId(), true);
		} catch (PortalException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (SystemException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}

	//Code for taking user to welcome page after activation
	byte[] encoded = Base64.encodeBase64(userEmail.getBytes());
	String encodedEmail = new String(encoded);
	String redirectURL="/web/guest/welcome?x="+encodedEmail;	
	actionResponse.sendRedirect(redirectURL);
}&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;strong&gt;Some Reference URL:&lt;/strong&gt;&lt;br&gt;&lt;a href="http://www.liferay.com/community/forums/-/message_boards/message/22493256"&gt;Reference1&lt;/a&gt;&lt;br&gt;&lt;a href="http://www.liferay.com/community/forums/-/message_boards/message/5657156"&gt;Reference2&lt;/a&gt;&lt;br&gt;&lt;a href="http://www.liferay.com/community/forums/-/message_boards/message/24255050"&gt;Reference3&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Subhasis Roy</dc:creator>
    <dc:date>2013-06-07T10:06:50Z</dc:date>
  </entry>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25128418" />
    <author>
      <name>Vilmos Papp</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25128418</id>
    <updated>2013-05-28T07:07:17Z</updated>
    <published>2013-05-28T07:07:17Z</published>
    <summary type="html">Hi,&lt;br /&gt;&lt;br /&gt;I&amp;#39;m not sure how 6.0 works as I usually work with the latest version but one approach could be:&lt;br /&gt;&lt;br /&gt;Create a hook plugin for login portlet to modify the registration process.&lt;br /&gt;&lt;br /&gt;Create a friendly-url-mapper to be able to create and handle nice URL for activiation like this: http://www.example.com/c/login/confirm_registration?userId=1234&lt;br /&gt;And process the URL with your custom logic implementation. Of course the URL should be added to the email template as well.</summary>
    <dc:creator>Vilmos Papp</dc:creator>
    <dc:date>2013-05-28T07:07:17Z</dc:date>
  </entry>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25125559" />
    <author>
      <name>Subhasis Roy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25125559</id>
    <updated>2013-05-28T05:42:20Z</updated>
    <published>2013-05-28T05:42:20Z</published>
    <summary type="html">&lt;div class="quote-title"&gt;Dharmen Panchal:&lt;/div&gt;&lt;blockquote&gt;Hi Subhasis Roy,&lt;br /&gt;&lt;br /&gt;The functionality that you are looking for is available in Liferay.&lt;br /&gt;The way to achieve is as follows :&lt;br /&gt;&lt;br /&gt;Goto control panel &amp;gt; Portal &amp;gt; settings &amp;gt; Authentication.&lt;br /&gt;&lt;br /&gt;Now make sure following checkboxes are checked&lt;br /&gt;      &lt;strong&gt;Allow strangers to create accounts?&lt;/strong&gt; &lt;br /&gt;      &lt;strong&gt;Require strangers to verify their email address?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This will enable Liferay to send confirmation email.&lt;br /&gt;&lt;br /&gt;Make sure you have configured your outgoing email parameters.&lt;br /&gt;&lt;br /&gt;Goto control panel &amp;gt; Server &amp;gt; Server Administration &amp;gt; Mail.&lt;br /&gt;&lt;br /&gt;Now apply your smtp settings for outgoing mails.&lt;br /&gt;&lt;br /&gt;Hope it helps you.&lt;br /&gt;&lt;br /&gt;Thanks.&lt;br /&gt;Dharmen Panchal.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hi Dharmen.&lt;br /&gt;&lt;br /&gt;This approach will not work as I need an &lt;strong&gt;ACTIVATION URL&lt;/strong&gt; in the email body which on click will activate the user in the portal.&lt;br /&gt;&lt;br /&gt;I am attaching the screenshot for Portal Setting and the Email I received after registering in the portal. In the mail content there is no activation link for the user account.&lt;br /&gt;&lt;br /&gt;Also I have added the following key to portal-ext.properties file&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;company.security.strangers.verify=true&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Can any one please help me on this.</summary>
    <dc:creator>Subhasis Roy</dc:creator>
    <dc:date>2013-05-28T05:42:20Z</dc:date>
  </entry>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25098810" />
    <author>
      <name>Muradali Hasan</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25098810</id>
    <updated>2013-05-27T07:17:23Z</updated>
    <published>2013-05-27T07:17:23Z</published>
    <summary type="html">Hi Dharmen Panchal,&lt;br /&gt;&lt;br /&gt;Yeah you shared the solution seems to nice.&lt;br /&gt;when we select the configuration as you mention the  user account has been created with status of inactive or active?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks-&lt;br /&gt;Murad</summary>
    <dc:creator>Muradali Hasan</dc:creator>
    <dc:date>2013-05-27T07:17:23Z</dc:date>
  </entry>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25096098" />
    <author>
      <name>Prakash Khanchandani</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25096098</id>
    <updated>2013-05-27T05:58:46Z</updated>
    <published>2013-05-27T05:58:46Z</published>
    <summary type="html">Now this is what happens to people like me who don&amp;#39;t read the User-Guide and don&amp;#39;t do their research properly before replying.&lt;br /&gt;&lt;br /&gt;Thanks &lt;a href="https://www.liferay.com/web/dpanchal/profile"&gt;Dharmen Panchal&lt;/a&gt; for the enlightenment.</summary>
    <dc:creator>Prakash Khanchandani</dc:creator>
    <dc:date>2013-05-27T05:58:46Z</dc:date>
  </entry>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25037944" />
    <author>
      <name>Dharmen Panchal</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25037944</id>
    <updated>2013-05-24T12:09:01Z</updated>
    <published>2013-05-24T12:09:01Z</published>
    <summary type="html">Hi Subhasis Roy,&lt;br /&gt;&lt;br /&gt;The functionality that you are looking for is available in Liferay.&lt;br /&gt;The way to achieve is as follows :&lt;br /&gt;&lt;br /&gt;Goto control panel &amp;gt; Portal &amp;gt; settings &amp;gt; Authentication.&lt;br /&gt;&lt;br /&gt;Now make sure following checkboxes are checked&lt;br /&gt;      &lt;strong&gt;Allow strangers to create accounts?&lt;/strong&gt; &lt;br /&gt;      &lt;strong&gt;Require strangers to verify their email address?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This will enable Liferay to send confirmation email.&lt;br /&gt;&lt;br /&gt;Make sure you have configured your outgoing email parameters.&lt;br /&gt;&lt;br /&gt;Goto control panel &amp;gt; Server &amp;gt; Server Administration &amp;gt; Mail.&lt;br /&gt;&lt;br /&gt;Now apply your smtp settings for outgoing mails.&lt;br /&gt;&lt;br /&gt;Hope it helps you.&lt;br /&gt;&lt;br /&gt;Thanks.&lt;br /&gt;Dharmen Panchal.</summary>
    <dc:creator>Dharmen Panchal</dc:creator>
    <dc:date>2013-05-24T12:09:01Z</dc:date>
  </entry>
  <entry>
    <title>RE: User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25035812" />
    <author>
      <name>Prakash Khanchandani</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25035812</id>
    <updated>2013-05-24T10:44:29Z</updated>
    <published>2013-05-24T10:44:29Z</published>
    <summary type="html">I would think it would be possible. But it would require custom development.&lt;br /&gt;&lt;br /&gt;Right now I can think of is the following:&lt;br /&gt;1) using a Listener hook when a User is added to make it inactive after creation.&lt;br /&gt;2) Or using a struts-action hook to intercept the Create account request and doing the needful.&lt;br /&gt;3) The URL generated can be to a custom portlet which might look for a combination of parameters to activate that particular user.&lt;br /&gt;&lt;br /&gt;Hope this helps.</summary>
    <dc:creator>Prakash Khanchandani</dc:creator>
    <dc:date>2013-05-24T10:44:29Z</dc:date>
  </entry>
  <entry>
    <title>User Id creation with an activation link email</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25030240" />
    <author>
      <name>Subhasis Roy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=25030240</id>
    <updated>2013-05-24T08:30:10Z</updated>
    <published>2013-05-24T08:30:10Z</published>
    <summary type="html">Hi All,&lt;br /&gt;&lt;br /&gt;I have the following requirement,&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Steps;&lt;/strong&gt;&lt;br /&gt;      1.- User enters in the &amp;#34;create account&amp;#34; form and enters all the user data: username, email, password, reminder question, etc..&lt;br /&gt;      2.- Liferay creates the account but the user is not active.&lt;br /&gt;      3.- Liferay sends an e-mail to the user e-mail account with a portal link to an url that activates the user&lt;br /&gt;      4.- When user clicks on the link in the email, his account gets activated&lt;br /&gt;&lt;br /&gt;Is it possible in liferay. I am using Liferay 6.0 CE</summary>
    <dc:creator>Subhasis Roy</dc:creator>
    <dc:date>2013-05-24T08:30:10Z</dc:date>
  </entry>
</feed>
