Pattern to implement user self registration
User self-registration is feature that allows users to create their own login and password, and hence create a new user identity on the system.
I am going to discuss an approach on how to do this. I've used a simple Model-View-Controller style design pattern to implement self-registration.
The VIEW
Or the Front end: (You need an input form that can be a JSF or a JSP, if you're a Java developer like me).
A typical form would have inputs such as: a username, screen name, password (and a repeat password), full name, address, email, secret question for password recovery, to name a few.
A view also forwards user input to a controller.
A controller defines application behavior. It dispatches user requests. A handler is an implementation of the controller.
Form Validation: Many checks can be done at the controller, such as checking for the length of fields, (you may want password lengths>8, and consisting of a mix of numbers and alphabets etc.), making sure password and repeat passwords match, email validation etc. This is where you would add such checks.
The controller controls the application behavior. If the form entries are invalid, then one would return to form entry view highlighting errors. If the form is valid, then the backend should be contacted.
Or the Backend.
A model represents business data and business logic or operations that govern access and modification of this business data.
This is the actual data model. You could use database tables to store your user entries.
You could expose operations on the table through a User Management API to allow creating, retrieving, updating users. As an example, the User Management API can be implemented using Persistence APIs in Java.
The controller would process the results and display a success page or an error if a user already exists.
At the highest level, an application should be able to control whether it wants to turn self-registration on or off. Read my other blog on LDAP based user authentication.
I hope you've found this blog useful. Comments are welcome.
Posted at 02:55PM Feb 15, 2008 by Manveen Kaur in General | Comments[0]