![]() |
Where should the authentication function go? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Where should the authentication function go? (/showthread.php?tid=12453) |
Where should the authentication function go? - El Forum - 10-19-2008 [eluser]bloodagar[/eluser] Hi I'm just a newbie on CI and I want to know: What's the best pratice for creating user/pass checking functions on a login form? Should it be in the Model (since the model handles data from the database, that's what I understand) or should I create a custom Library? Thanks in advance! ![]() Where should the authentication function go? - El Forum - 10-19-2008 [eluser]bloodagar[/eluser] Update: Got it resolved! I changed Code: $this->db->get('users') Code: $this->db->get('users')->result_array() ![]() Quote:Also I got another problem, whatever I type in the username/password inputs it allows me to view the secure area. Here's the code: Where should the authentication function go? - El Forum - 10-19-2008 [eluser]Colin Williams[/eluser] To the original topic, I've actually just considered rewriting a User library I wrote as a Model. I don't know that I like the Model interacting with the session and doing the access checks, among other things. But, I wouldn't want to have it all scattered across a user model, user library and user helper (which might be appropriate). I don't know. I'm still up in the air about it :-P Where should the authentication function go? - El Forum - 10-19-2008 [eluser]RogerM[/eluser] I am not sure about this either. I have my user auth in a model now, but something doesn't feel right. Roger Where should the authentication function go? - El Forum - 10-19-2008 [eluser]bloodagar[/eluser] Colin Williams: Thanks for the insights! I'm thinking: If it involves the database, put it in the model. Otherwise put it in a library. RogerM: I feel the same way. Actually a lot of times I feel unsure because I'm new to CI and I'm worried about developing with bad practices in my code... Where should the authentication function go? - El Forum - 10-19-2008 [eluser]RogerM[/eluser] I am new and learning, I have restarted my current app a few different times, because I learned something new. Hope everyhting works out |