Welcome Guest, Not a member yet? Register   Sign In
Should you use authentication conditionals within a Model
#2

[eluser]Otemu[/eluser]
Hi,

Normally I have authentication on the model and return true or false depending on the results. Then depending on what I want to happen, I could redirect or display some sort of error message using controller/view.

If your using the Codeigniter Validation class, you could use a callback to authenticate first before proceeding further. I am not sure if any of these methods will help you with your unit testing but just thought I provide my input :-)

Thought I better edit and add more: due to all the responses as this now seems like a very bad response. The type of authentication I was referring to was when your checking the database to login a user, for example you have a login form, first you run the validation(controller), if it passes then check if the user exists(model) return false or true and then display whatever message on the view or redirect(controller).

Sorry I kind of jumped ahead with the answer without probably giving it a more detailed answer like the other great response below.

Anyway least it all solved :-)


Messages In This Thread
Should you use authentication conditionals within a Model - by El Forum - 01-21-2013, 10:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB