*Sorry, been out-of-state for the past week and just trying to get caught up on my OP.*
This, right here. Zandstra's book is a great introduction to the subject.
I have heard this and would like to read this book, but for right now want to focus on my specific issue.
Regarding your registration class, you have some questions to answer:
1. Do you need an instance of this class, or can it be static (no constructor, with all functionality handled by static methods)?
Good question.
2. What will the registration class return when someone is registered, if anything? IMO, it makes sense to return a User object whose 'loggedIn' field is set to true so you can pass it around via sessions, thereby turning your registration class into a factory. Just a thought.
Well, the process would go like this...
- User completes registration form
- System verifies required fields are completed
- System verifies emails match
- System verifies passwords match
- System verifies email is valid
- System verifies password is valid
- System verifies email is unique
- System creates User record
- System notifies User account was created
- System requires User to log in
I was thinking "Authentication" could be a separate class...
3. What else needs to happen during the registration process? Extra logging? Error handling? You may be well served by utilizing the Observer pattern here.
I don't follow you?
Another reason I wanted to make "Registration" a class is that it then be extended. For an e-commerce site, I've been advised by others to "make it quick and simple before people leave", but for something like "Forum Registration", I would like to add extra things like...
- System creates User record
- System notifies User account was created
- System requires User to activate account
- System sends "Activation email" to User
- User clicks on "activation link"
- System receives incoming "activation email"
- System activates account
- System instructs User to log in
TomTees