Welcome Guest, Not a member yet? Register   Sign In
User Authentication
#1

[eluser]Moon 111[/eluser]
If I were to make a user authentication system, where would I check if the user is signed in?

Obiously I don't want to have an if expression in every controller. How would I do this?
#2

[eluser]Moon 111[/eluser]
Some help would be wonderful.
#3

[eluser]jkevinburton[/eluser]
Look into the Wiki for a "Loader" library.
I put it in there - in the constructor.
#4

[eluser]manilodisan[/eluser]
Create a library which is autoloaded by Codeigniter and perform your tasks there,.
#5

[eluser]Rick Jolly[/eluser]
Or use controller inheritance. All secure pages would extend a parent controller that does the authentication check in its constructor.
#6

[eluser]llbbl[/eluser]
do it in the constructor and it will check for every function within the class
#7

[eluser]Moon 111[/eluser]
[quote author="Rick Jolly" date="1222373144"]Or use controller inheritance. All secure pages would extend a parent controller that does the authentication check in its constructor.[/quote]

How exactly would I do that?
#8

[eluser]Moon 111[/eluser]
OK, I think I've got it, but how to I make it "die" if the user isnot premitted toview the page?
#9

[eluser]Moon 111[/eluser]
Come on. You know, I choose CI because of the "amazing community" it's supposed to have. Tongue
#10

[eluser]Rick Jolly[/eluser]
So in the constructor of the parent controller, if the user isn't authenticated (check a session variable), then redirect to a login page.




Theme © iAndrew 2016 - Forum software by © MyBB