CodeIgniter Forums
store last requested page -> login -> send back to page !- ajax - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: store last requested page -> login -> send back to page !- ajax (/thread-12207.html)



store last requested page -> login -> send back to page !- ajax - El Forum - 10-10-2008

[eluser]jstrebel[/eluser]
I am using the Freak Auth lib, and in MY_Controller (every page load) I am setting a session variable to store the last page requested:

$this->db_session->set_flashdata('requested_page',$this->uri->uri_string());

Freak Auth's login routine checks for this, and after login, does a nice job of putting you on the page you requested before auth.

I am having a problem though that if a controller is requested via AJAX.. and auth check fails, after login it sends the user to the ajax controller, not the fully rendered page that included the ajax call.

xample page is /foo/bar/1 and the link clicked is an ajax call to /vote/cast, auth check fails.. /vote/cast is being stored as requested page.. so after login, a small view snippet for a vote box is all the you see, as the controller is only meant to be accessed via ajax, not directly.


i am sure the solution is simple, but my head is slow tonight.