Page access with email

Author Message

Antoine Dubois

Tuesday 26 October 2010 12:39:44 am

Hi guys,

I have to developp something that can sound weird... or not.

My client want the anonymous users to enter their email adress to access a page. Those email adresses would be stored in a table.

Any clue on how I could realize that?

Thanks in advance.

Antoine

Nicolas Pastorino

Tuesday 26 October 2010 1:03:25 am

Hi Antoine,

Sounds like something you should handle through a javascript overlay or something, then store the status of email gathering as cookie (since this applies to anonymous users, you will hardly have another way to do it). I suppose email harvesting should happen only once.

Cheers !

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Antoine Dubois

Tuesday 26 October 2010 5:05:44 am

Hi,

Thanks for your answer but I wanted the emails to be stored. So I digged a little and it appears that a custom module is the easiest.

Here's what I did :

I created a emailtoaccess module and activated it.

Within a askemail view, I look in the session to see if the emailaccess is set, if yes, then I redirect to the page. Otherwize I show a template with a form asking an email address. The action of that form is a setemail view within which I validate the email (if not redirect to askemail), put that mail in session, store it in the db and then redirect to the restricted page.

Hope it could help someone...

Cheers

Antoine

Nicolas Pastorino

Tuesday 26 October 2010 10:20:49 am

Hi Antoine,

Does this mean that for every page requested, the custom module/view is run ? I hope this is not the case, due to severe user-experience damages :)

Let us know,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Antoine Dubois

Tuesday 26 October 2010 11:09:36 pm

Hi Nicolas,

No the view is not run each time the page is requested.

I did two simple operators, one to check if an email has been set in session and another one to redirect to the email form view.

In the restricted access page template, I call the first operator and if no email has been set, I call the second operator so the user is redirected to the email form.

Once the user filled his email, this email is put in session (a cookie is even created), and so next time I'll want to acces the page, the email form won't be displayed.

I think it's not provocating severe user-experience damages... what do you think?

Nicolas Pastorino

Wednesday 27 October 2010 1:53:26 pm

Alright, not too harsh with performances then.

If a cookie is set, you could go the JS way, externalizing the slight overburden to the client end : let the page load, immediately test the cookie from javascript, and redirect (still from JS) to the email-harvesting page if no relevant cookie was found. The one issue with this solution is that it solely relies on js, thus might not work if disabled on the user's browser.

Cheers !

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.