Interesting challenge: multi - step user registration

Author Message

Massimiliano Bariola

Tuesday 12 July 2005 4:03:12 am

Hi,

I am trying to decide what would be the best way to achieve what follows:

I have a database of non - eZpublish-like user data, coming from a legacy application. Now we are developing an eZ solution in which most of those users will be creating their own profiles. Some will be new users, others will be old users which need to hook their eZ profile with their old profile data.

What we need to do, is implement this logic:

0) We have a WTUser class which is just like the User class, but with an IDAnagraphic field, which defaults to 0.
1) user starts registration process inserting desired login, password and email as now is by default eZ registration procedure. (we could need more fields to be entered too, at this point).
2) the system checks whether the provided email is into the legacy user data, which is accessed through a custom-developed extension.
3) if there is a match, the unique numeric ID from the legacy data is copied into the IDAnagraphic field for the user.
4) Registration proceeds as normal, with sending of activation emails, etc.

So, basically, the challenge is:
- calling the custom extension to check for emails and ID (I have defined fetch methods for it, so I can use them in templates)
- modifying the flow of operations for the registration process, so that the operations above will override the normal user registration process.
- make a solution that will work even for new users (that is, no legacy profile available).

I have no idea on how to do it cleanly.
hacking the kernel?
creating a custom workflow? and if so, how?
... or maybe just forget about default user registering and write my own user register logic from absolute scratch? (*yeck*)

Any suggestions or pointers are appreciated.

Mikael Johansson

Tuesday 12 July 2005 7:19:45 am

I don't think that it is a good idea to call your functions from templates, at least not if you are using caching, since then the template code might not be run (I think).

Maybe this thread can help?
http://ez.no/community/forum/setup_design/ldap_questions/re_ldap_questions__4

Mikael Johansson, Sweden

Massimiliano Bariola

Tuesday 12 July 2005 8:10:46 am

hi Mikael,

what you suggest could be a way to go .... I could change my program flow to defer anagraphic data insertion at the time of first login.

so, do you think it's possible to do something along the lines of
- I register myself via normal ez registration process
- I activate my account
- I log in
- my custom handler detects that my IDAnagraphic field is 0 so I need to provide additional data (which I do ....)
- all subsequent logins, as I will have already provided my data, will not ask me again for my data (and the only place where I have my login/password will be only in my database).

is something like this achievable? I have read about cronjobs, etc. but I need a on-demand run-once check at login time.

BTW -- Maybe I wasn't clear, but I don't need to import the user data into eZ publish! the only thing about those users which I need in eZ is a stripped-down version of the User class (to allow login and eZ user handling). All other user data *must* stay in the outer DB.

Mikael Johansson

Tuesday 12 July 2005 8:50:02 am

Just to make sure I am following you:
Do you want the users to use a password stored in eZpublish to log in or is the password stored in the legacy database?

Is this what you want:
* User A has no information in the legacy database, so user A registers as "regular" eZ-user and everything works as usual.
* User B has information in the legacy database. She registers as an usual eZ-user but at the first login the system detects that the user exists in the legacy database and will not let the user access any content before entering some extra information. After that the user proceeds as usual, maybe with more privilegas than user A.

Correct? If not, please explain further.

Mikael Johansson, Sweden

Massimiliano Bariola

Tuesday 12 July 2005 9:19:22 am

no, situation is like this:

there is no login info in the old database. just anagraphic info, and other info which is relevant to the other clients which are using it. Due to contract limits, I cannot import this data into eZpublish. I have to access and write it through my own extension, and keep it on a separate db.

After login, Program logic then goes like this:

1- eZ user profile 's IDAnagraphic field is >0 ? ok, take her to the page she wanted to access.
2- else, ask for the relevant data fields which could determine whether she has a profile in the legacy database.
2a- if check is positive, write the relevant foreign key value into her ezUser IDAnagraphic field, and take her to her personal page.
2b-if check is negative, display the full input mask so that this data can be entered into the legacy database. then, update the IDAnagraphic field for her eZ profile and take her to her personal page.

After rewriting this, I think that maybe the best hassle-free way for doing this is :

- let her login
- make login redirect to her personal page
- incorporate points 2 ,2a, 2b into the logic of a custom template for her personal homepage.

now I only have to discover how to make the login behavior correctly redirect to personal home page or to requested page depending on user profile status (1 or 2).

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