Tank auth and integration questions |
[eluser]Unknown[/eluser]
Hello all, i am fairly new to codeigniter. I am currently trying to build my first project with it, so excuse me if my questions are... dumb. I have a controller called "Pages" which basicaly loads a view (a complete html template) that contains a header, body and footer. Depeding on the page, it changes the title, the js and css files to be loaded etc. (each page is a method in the pages controller). So right now, i am trying to integrade tank auth to my design. Tank auth already has a controller that print the login form, register form e.t.c. What i want to do is be able to print the login form inside my own design (the content area). What i am currently doing is this... I copy the "login" method of the "auth" controller to the "pages" controller and modify slightly like that: Code: function login() So i am calling pages/login instead of auth/login and all is fine. But i am wondering, is there an easier and/or better way of doing this? Thanks for any replies!!!
[eluser]Nick_MyShuitings[/eluser]
I can't stand to see orphan posts like yours. And since I've broken my two year forum lurking streak, here's my two bits. First off, I love Tank Auth and have extended it to handle roles, which was its one lacking piece in my opinion. Secondly, its a matter of convention and personal preferences how you manage your controller. I personally use Matchbox and some fancy .htaccess and $routes rules to handle anything user related with a url that looks like .com/user/XXXX, whether that is login, logout, register etc. The reasons for separating controllers in my opinion is for separating not only the logic, but also the displayed url. You have to think of other things, like loading models and libraries, and trying to group methods that load the same models and libraries into the same controller. Its about cleaning up your code... likewise you could create one controller and have every single method of your application within it each of them loading their own models and controllers... but that would be hideous to maintain. Hope that helps.
[eluser]Unknown[/eluser]
This was one of my questions also (my first app as well) and I am starting with tank_auth (adding in the roles). My other question is I am also using the haughin facebook connect module converted for 1.7.2. If connecting with facebook for authentication, how would you go about bypassing the tank_auth yet still creating an entry in the users table for new users, register the facebook info to the current CI session, and use that data? The thing is before the facebook user uses the site, I want them to create a username. Am I overcomplicating this or am I on the right path as far as the third-party integration?
[eluser]Nick_MyShuitings[/eluser]
Personally you are on the right path... and the Haughin libraries are great. (I downloaded them all right before he redid his site, and he hasn't uploaded some of them... good stuff). Here is a very brief idea of how I connected facebook to my other App back when I was using DX_Auth, I need to redo the modification to make it work with Tank but the logic is the same. I first created modified version of the registration functions which allowed me to call them from the backend and bypass things like the email verifications etc. When the facebook connect process finished I then presented them with a small form to create their local profile username and set a backup password etc, then I trigger the custom registration and stored the facebook values (I used the graph API oauth tokens, but you could use just their facebook name or pull info from the cookie etc.) in the users table (modified to add new columns). I then used the permissions of the graph API to pull in and autopopulate their user profile fields. That is my personal preference, it allows them to logon with Facebook but they also have a phsyical account with my system that they could use to login with username and password. Regardless of how they logon I have the auth tokens and can provide facebook integration options like posting, liking etc. Whenever they hit a page on my site that would check for session, if it doesn't find the site session it attempts the connect code and then matches the auth tokens with the records in the db and logs them in (thus setting the site session as well) I have friends who prefer a more classical approach where connecting via facebook connect does not actually create them a username in the database... but I find that doing it that way requires a lot of duplicate code later, for commenting on posts, forum, quizzes etc, since you don't have the normal user session. Best Regards. PS I do the same logic for Twitter oAuth... so my users can create an account or connect via facebook, twitter, or any other oauth provider... however they go about it I create them a username on the backend. [EDIT] I just checked http://socialize.haughin.com/index.php looks like its time to check this out!
[eluser]sharif.macky[/eluser]
It would be great to get Tank Auth integrated with Facebook login. Has anyone already done this?
[eluser]c77m[/eluser]
So in extending Tank_auth, did you create a new library that extended the original, or did you simply hack the code to your liking? While I suspect the former might be the "right" way to go about it, I don't know that I'll ever update the Tank_auth code once it's rolled out onto the site. I plan on implementing the same that was referenced above: adding roles and profile fields to the users as well as eventually allowing Facebook mapping to localized accounts.
[eluser]Leonel Folmer[/eluser]
Hello everyone. I am studying this beautiful code, everything works fine except the e-mail sending to retrieve the password. anyone had the same problem? I configured the e-mail correctly, but does not work. Code: $config['webmaster_email'] = '[email protected]'; Thanks.
[eluser]Leonel Folmer[/eluser]
Well, I finally found the solution. for future questions about this, it was a configuration problem. to properly set up, just go to system\libraries\Email.php and put the correct server information. Code: var $mailpath = "/usr/sbin/sendmail"; // Sendmail path
[eluser]TayloeGray[/eluser]
Would you be willing to share the Facebook code that links to Tank Auth? That is exactly what I am working on. Thanks, Andrew
[eluser]Unknown[/eluser]
For future searchers, check out X Tank Auth. It has quite a few 3rd party authentication. http://xta2.ericbae.com/index.php/auth/login |
Welcome Guest, Not a member yet? Register Sign In |