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.

eZ debug

Timing: Jan 18 2025 04:56:54
Script start
Timing: Jan 18 2025 04:56:54
Module start 'layout'
Timing: Jan 18 2025 04:56:54
Module start 'content'
Timing: Jan 18 2025 04:56:55
Module end 'content'
Timing: Jan 18 2025 04:56:55
Script end

Main resources:

Total runtime0.9171 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 589.0234152.6250
Module start 'layout' 0.00780.0034 741.648439.4375
Module start 'content' 0.01120.9044 781.0859571.3516
Module end 'content' 0.91560.0014 1,352.437516.1875
Script end 0.9170  1,368.6250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3963160.0002
Check MTime0.00140.1526160.0001
Mysql Total
Database connection0.00100.104510.0010
Mysqli_queries0.847492.4050660.0128
Looping result0.00070.0739640.0000
Template Total0.877995.720.4389
Template load0.00220.236520.0011
Template processing0.875795.484220.4378
Template load and register function0.00050.049910.0005
states
state_id_array0.00100.111710.0010
state_identifier_array0.00110.115820.0005
Override
Cache load0.00190.2033410.0000
Sytem overhead
Fetch class attribute can translate value0.00060.068420.0003
Fetch class attribute name0.00120.130470.0002
XML
Image XML parsing0.00060.064620.0003
class_abstraction
Instantiating content class attribute0.00000.002590.0000
General
dbfile0.00220.2408160.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs