RE: Confirming users email address when they register

"Nicolas Lafaury" <[email protected]>
Newsgroups gmane.comp.cms.jahia.devel
Message-ID <[email protected]>
Hi again

I am trying to be clearest


On a JahiaPage I have a input Box that allow a user to enter an email.


<form method="post" action="<%=((PageBean)pageNewsletter).getJahiaPage().getURL(jParams)%>">
<input name="textfield" type="text" value="Votre email"/>
<input type="image" src="<%=theURL%>/images/cg_21/bt_ok.gif" style="width:21px;height:20px;padding : 2px;position:relative; top: 8px;border:0;" alt="ok"/>
</form>

This html code send the email to the page.
The page check if the email has a correct syntax.
To do that I use java regular expression.

<%String textfield =request.getParameter("textfield ");%>
chaineExprMail="^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
if (java.util.regex.Pattern.matches(chaineExprMail,textfield)) {		 		
				 	
Then you send an email by using the API java with a link to the validating page. 

<a href="<%=jData.params().getSiteURL(jData.page().getID(), false,false)%>?validateEmail=<%=texfield%>">validate</a>

The guy click on the link and send to the page the parameter. Then you catch this parameter.

<%String validateEmail =request.getParameter("validateEmail");%>


And you register the user in Jahia y using API.

JahiaUserManagerService <http://www.jahia.org/javadoc-dev/org/jahia/services/usermanager/JahiaUserManagerService.html> 


I do something like that but I use a database to store the email which is waiting validation. Then when the page receive a parameter I check if the user is in database.
Another point is that I encode the parameter to not allow a person to add lot of user by just writing an email in the URL.

I hope this will help you, do not hesitate to contact me today if you want more explanations, because I am going in holiday tomorrow.

Nicolas

For exemple : www.mySite.fr/jahia/Jahia/pid/XXX
Use the standard API Jahia

-----Message d'origine-----
De : Edd Dawson [mailto:[email protected]] 
Envoyé : vendredi 19 août 2005 12:32
À : [email protected]
Objet : Re: Confirming users email address when they register

Hi Nicolas

What you explain is exactly what I wish to acheive.

How complex was it to do? Any clues on how you acheived it would be 
really good :)

thanks
Edd

Nicolas Lafaury wrote:

>Hello
>
>I don't understand exactly what you want to do?
>You mean in administration mode or the user register to the site with the HTML code then you check its email?
>
>I have createn a template to do simimlar things.
>
>On a page the user enter his email.
>I check by regex if the syntax of the email is correct => 
>
>chaineExprMail="^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
>
>then I send an email to the customer with a link to a special page of my site.
>Ex: myJahiasite/.../pid/...?mail=monemailvalidating
>
>When he click on this link, I register the User in Jahia.
>
>I hope this will help you.
>
>Nicolas
>
>-----Message d'origine-----
>De : Edd Dawson [mailto:[email protected]] 
>Envoyé : vendredi 19 août 2005 12:05
>À : [email protected]
>Objet : Confirming users email address when they register
>
>Hi Everyone
>
>Has anyone any experience of validating users email addresses who 
>register with a jahia site before activating their account..
>
>I am thinking by the usual method of emailing them a url to activate 
>meaning their account is locked until such a link is visited.
>
>Any idea on complexity of acheiving this with Jahia would be appreciated.
>
>cheers
>Edd
>
>
>
>
>  
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.