This is a summary of how a user would login in my application(up to validating the data):
Submit the login form.
Router figures out where the user is trying to go.
The correct
Controller
is initialized.The
RecognitionService
is started and thelogin()
method is run.Within the
login()
method I set the supplied username and password in myUser
domain object.My
User
domain object will check if the username and password are valid by checking their type, length, format etc.
All this is good except for when the entered username contains invalid characters and then getting the error message from my domain object back to the View
in a neat and tidy way.
At the moment I am having my domain objects return the message (well really the array key to the message) to the RecognitionService
which then holds onto the message array key and then in the View
I retrieve the message array key from the RecognitionService
and use it to display the correct message but I have a feeling there is a better way of doing it, any ideas?
Thanks.