CodeIgniter Forums
Auth library breaking MVC? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Auth library breaking MVC? (/showthread.php?tid=2599)



Auth library breaking MVC? - El Forum - 08-14-2007

[eluser]gon[/eluser]
Hi everyone,

I've developed a small Auth library.

I want the login form to appear in lots of pages, and that the messages (incorrect login, etc.) appear near the form, and in the same page where the user was.

So I've placed the Auth code in a library.
I load it in my controller constructors, and the library checks sessions, and, if POST fields are sent, proceed to login, logout, or whatever.

In the controller actions I use the Auth object for getting the login state, and the login forms (which will include validation info if it has been set by the Auth object).


When the login is correct, the Auth object performs a redirection on the same page.

The object must take actions depending on which params are set in the POST array.


This works OK, and I was thinking on implementing it as a Hook.

I am working against the rules, or best practices of CI?

TIA.