Welcome Guest, Not a member yet? Register   Sign In
Avoid using other libraries in own library
#2

Trying to combine validating a login form - And - returning a user session - both in the same method - is messy. "A method should do one thing and do it well." (Robert Martin) Codeigniter form validation is awesome because of all the different things you can check. But if all you are checking for is if there is a value in the form field then you could easily do without it. Something to consider - instead of just checking whether a user is logged in, you can also return a $this->user object to then be available in your application. So then instead of something asking 'is this user logged in?' - it can try to get the user object, and if its not returned, redirect to the login page.
Reply


Messages In This Thread
RE: Avoid using other libraries in own library - by cartalot - 08-03-2016, 05:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB