Welcome Guest, Not a member yet? Register   Sign In
Good ways to implement an authentication system in CI
#1

[eluser]luismartin[/eluser]
I'd like to know good practices to implement myself an authentication system in a CI application.

I'm weighing up two ways:

- To have a library I would call Login, Authentication or User, which is loaded from every controller constructor. It would use CI Sessions to store userid, username, etc. In case the user is not logged in, it would redirect to the URL managed by a Login controller, to display the login form.

- To implement a 'post_controller_constructor' hook having a class called Login/Authentication/User that handles the session data devoted to store the userid, username, etc. If the user is not logged in, then it would redirect to a Login controller, as previously.

I'm not very experienced in CI, so I would like to know your ideas, or the common way to do this.




Theme © iAndrew 2016 - Forum software by © MyBB