Part of the EllisLab Network
   
1 of 22
1
Tank Auth v1.0 (CI authentication library)
Posted: 07 April 2009 09:13 AM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  52
Joined  04-07-2009

Hi folks,

I’d like to introduce a new authentication library for CI, based on DX Auth.

The original DX Auth is pretty good, althouth it’s not as convenient to use as it could be. Also it has some leaks in security, what is proved by this test:  What Code Igniter authentication library is best?. Those were the reasons to make it better.

There are some keypoints of the new lib:

  * Very compact (less than 20 files and 4 DB-tables)
  * Using phpass library for password hashing (instead of unsafe md5).
  * Login using username, email address or both (depending on config settings).
  * Registration is instant or after activation by email (optional).
  * Forgot password (letting users pick a new password upon reactivation).
  * Change password or email for registered users.
  * CAPTCHA support (native and reCAPTCHA are available).

and many more…

Here is the link to detailed descripton with installation guide.

And this is a link to the zip-file.

Profile
 
 
Posted: 08 April 2009 12:01 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  434
Joined  07-31-2007

First: thanks a bunch for sharing… I definitely appreciate the effort and I"m excited to check Tank Auth out!

So, I feel a little guilty to have to make a somewhat negative comment right of the bat, especially considering that it might seem trivial to some but… If this is based on DX Auth, it’s too bad you went out of your way to replace the well structured Standard compliant markup in the views with some not so well coded table based HTML, with inline styles…

But I don’t want to just criticize, so if you’d like me to help with that part, I’d be more than happy to redo the HTML/CSS in the views for you. Just shoot me an email if you’re interested.

 Signature 

——————————————————-
Perfection is not when there is nothing to add, but when there is nothing to take away.

Profile
 
 
Posted: 08 April 2009 03:28 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  273
Joined  06-11-2007

one of the few things i would add to this is a kickass access system, especially one that could work on a CMS for instance where the pages are stored in the DB and you might want to lock certain people out of certain pages.

Profile
 
 
Posted: 08 April 2009 05:16 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  52
Joined  04-07-2009

minimal design, thank you for the time you’ve spent on Tank Auth. This is my first experience of writing an open library, and I appreciate any comments on it.

What about removing some parts of HTML code from views… Well, I think that the authorization library cannot be used separately, standing alone on a web-server just for user authentication. It should be a part of some project, like social net, blogging platform or something else. So you’ll have to integrate it into code of your web-project and make a proper HTML-layout for every form or warning message—to make it look native for your site. I think that when view-files contain only necessary code then this integration will be much more easier. You won’t need to look through dumps of redundant HTML-tags and remove them because they don’t fit your site’s style. You have just to add your own layout (and maybe modify existing code a little bit).

That’s why I removed almost everything from views. smile

On the other side, email templates contain correct HTML-layout (including DOCTYPE), because it’s the part that likely won’t be modified according to the style of your site.

Profile
 
 
Posted: 08 April 2009 09:07 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
RankRank
Total Posts:  203
Joined  07-31-2008

I’m thinking about checking this out since it sounds very promising. One thing that always holds me back from using someone elses auth system is the complications with adding new fields to a user. How hard would it be for me to add say, a field called “hometown” and something like “eye color”. See where I’m going with this? If this won’t be too hard, I’m all up for giving it a run…

 Signature 

Spam Helper | Html Helper | GPoll Library | IMAP Library

Profile
 
 
Posted: 08 April 2009 03:47 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Avatar
Rank
Total Posts:  52
Joined  04-07-2009

Hi Iverson,

Adding new fields to a user is very easy. In fact I can do it for you. smile Take a look, there is an old user_profile table structure (from database schema at schema.sql file):

CREATE TABLE IF NOT EXISTS `user_profiles` (
  `
id` int(11) NOT NULL AUTO_INCREMENT,
  `
user_id` int(11) NOT NULL,
  `
country` varchar(20) COLLATE utf8_bin DEFAULT NULL,
  `
website` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  
PRIMARY KEY (`id`)
)
ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

To add a couple of new fields (“hometown” and “eye_color”) you need to replace it with this table:

CREATE TABLE IF NOT EXISTS `user_profiles` (
  `
id` int(11) NOT NULL AUTO_INCREMENT,
  `
user_id` int(11) NOT NULL,
  `
country` varchar(20) COLLATE utf8_bin DEFAULT NULL,
  `
hometown` varchar(40) COLLATE utf8_bin DEFAULT NULL,
  `
eye_color` enum('brown','blue','green','orange','black') DEFAULT NULL,
  `
website` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  
PRIMARY KEY (`id`)
)
ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

And that’s all! When user is registered a new record in this table is created automatically (and it deletes only when user deletes their account). So I see no problem with adding new fields.

The real problem may be with editing this data. In fact, Tank Auth doesn’t contain a controller or a method to edit user profile. It can only create and delete them. Profile management is beyond this lib version capabilities.

I agree it sounds silly, to create empty profiles without option to fill them, so it should be a 1st To-Do for the next version of the library.

Profile
 
 
Posted: 13 April 2009 04:43 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  366
Joined  04-27-2006

Hi, I installed your package,
tried to register,
typed in 10 times the captcha code, that did not work,
then I switched it to case insensitive, did not work…
then I switched the capcha off…
tried to register, had problems with sending mails….
windows xp with xampp, using an external isp as mail server
...
needed a long time trying to alter the php.ini with smtp_user and smtp_pwd settings,
until I read somewhere that this simply does not work with mail()...
so this problem is gone now,
but do you know why the captcha does not work??

Profile
 
 
Posted: 13 April 2009 05:09 AM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  52
Joined  04-07-2009

Hi gunter,

Tank_Auth uses native CI captcha, that not perfect. I agree that sometimes it’s very hard to recognize what’s written on it. Moreover, it may show ‘0’ (a letter) or ‘0’ (zero) and there’s no way to distinguish them.

If you met this problem, I would recommend you to play with captcha settings, and firstly to change the font. It’s $config[‘captcha_fonts_path’] parameter in config-file. There are 5 different fonts available, from 1.ttf to 5.ttf. Try 2.ttf, maybe it will be more convenient to you.

The other way to solve the problem is to use reCaptcha. I use it in my project, and it works fine.

Profile
 
 
Posted: 13 April 2009 05:22 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  366
Joined  04-27-2006

thanks, now it works!
the unreadable font was exactly the problem!!!

Profile
 
 
Posted: 14 April 2009 11:50 AM   [ Ignore ]   [ # 9 ]  
Summer Student
Total Posts:  23
Joined  11-05-2008

Where did the role_id run off to? Are roles managed another way? Otherwise I’ll just write roles myself.

Profile
 
 
Posted: 14 April 2009 03:29 PM   [ Ignore ]   [ # 10 ]  
Grad Student
Avatar
Rank
Total Posts:  52
Joined  04-07-2009

The lib contains only core auth methods. Sorry, role management is out of them.

Profile
 
 
   
1 of 22
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 721, on January 06, 2010 09:38 AM
Total Registered Members: 115012 Total Logged-in Users: 69
Total Topics: 122446 Total Anonymous Users: 5
Total Replies: 647326 Total Guests: 553
Total Posts: 769772    
Members ( View Memberlist )