CodeIgniter Forums
Ion Auth - Lightweight Auth System based on Redux Auth 2 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Ion Auth - Lightweight Auth System based on Redux Auth 2 (/showthread.php?tid=27435)



Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-10-2010

[eluser]Ben Edmunds[/eluser]
Thanks n0xie, I just pushed your code.

And also thanks Bernd, pushing your fix now.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-11-2010

[eluser]Schumacher[/eluser]
Hallo, first of all, thx for a very nice library !
But there was one thing i just got me wandering.
I got this site im making, and i would like to make it so ppl are able to login on every page, therefore ive made a loginbox in my left side. but then i also would like that ppl get redirected back to the page they came from, either with an error message or with an success message. the thing is, that i don't know how to get the error messages to come on the page they logged in, in a smart way. I tried to have the $this->data['message'] set with either the validation_errors or the flash_data set in the constructor but that didn't seem to work out.
So, hopefully someone can help me out here with this problem Smile.. before i knew of the auth lib i used to use form_validation callback_ functions do to the check against the database so all my errors was in the validation_errors.
Hope you got some ideers :p


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-11-2010

[eluser]InsiteFX[/eluser]
Users Guide - FlashData

InsiteFX


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-11-2010

[eluser]Ben Edmunds[/eluser]
Schumacher,

If you're still having issues let me know. You should be able to just use session flashdata to store the errors/messages.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-12-2010

[eluser]Schumacher[/eluser]
Yes i know about the flash data .
But the issue is that i want to have every controller to be able to handle these. Because the user can be redirect back to that page(with another controller) from the auth controller.
so in the example you've made with it, to have an else on the from_validation->run which sends back the login page. But here i want to have the that it redirects the user back to the page he was on before. So that he stays on the same site during the login atempts.
ive tried to have a hidden post comming along in the form with the url and then i redirect the person back to that page via the value of the hidden.

hopefully it makes sense.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-12-2010

[eluser]n0xie[/eluser]
You could do the login via Ajax: that way the user never leaves the current page, saving you a lot of hassle, trying to implement some kind of 'redirect back to current page' logic.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-12-2010

[eluser]Schumacher[/eluser]
n0xie that is a great ideer, but the issue is that i dont know ajax that well. Ive tried to learn some Jquery, but to mix it with the php.. that dosn't seem clear to me, how to do it.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-12-2010

[eluser]Ben Edmunds[/eluser]
Schumacher,

This jQuery code should get you started:

Code:
var email = $('#loginForm input[name|=email]').val();
var password = $('#loginForm input[name|=password]').val();
$.post('auth/login', {email: email, password: password}, function(data) {
    obj = $.parseJSON(data);
});

You would then create a JSON response from auth/login and process it with JS.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-12-2010

[eluser]Schumacher[/eluser]
any place its good to get this to know? ive seen some jquery tuts about it, but not gone further down into it. Smile?


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 04-12-2010

[eluser]Ben Edmunds[/eluser]
Schumacher,

I usually learn something new best by reading a couple of tutorials and then just jumping into the API docs and trying things out.

Everyone learns differently though.