I am building a custom user registration/login/ bla bla bla library for code igniter.
I am looking for some hints as to what direction to take for the library.
I.E obviously as well as the general library file you are going to need some other functions that call the library.
Where should validation logic go?
Scenario
we make a request to http://example.com/user/register/joe@mail.com/joesPassword
Now at some stage the register
function in the user controller needs to call the register
function in the user library.
Do I build the validation (already exists, password required, email valid, password meets minimum criteria etc) into the controller or the library.
My initial instinct is to build the validation into the controller and leave the library functions to do only one thing. I.e the register
function in the user library would simply sha1()
the password and insert the username/password into the database.
Am I going along the right track here, or should the library do all the work and the controller simply act to receive and pass on the request?