Welcome Guest, Not a member yet? Register   Sign In
CL Auth [BETA] v0.2.5
#1

[eluser]FlashUK[/eluser]
Features:
* Remember Me (inspired by phpBB3)
* Forgotten Password
* DB Sessions
* Better Captcha
* URI Auth management (see below)
* Email Verification
* Login using Username OR Email address
* Password encryption with MD5 MCrypt
* Extendable user profile
* Optimised for performance

CL Auth does not come with an Admin Panel

UPDATED: 17th August 2008
Latest changes (.5) was made to include the example files. No functions have changed.

 

NEW BETA v0.2.5 Available

Download CL_Auth_BETA-v0.2.5.zip

You can download the example files separately here:
CL Auth - Example files

Online Documentation

Changelog

View Screenshots Here

 

URI Auth management

Compared to ordinary Auth library's that use hardcoded user groups in the controller to control access to the file, CL Auth uses a dynamic system using the URI.
CL Auth checks access to a file via a database record, making it very flexible and fast to grant or revoke access to a bunch of groups.
The best thing about this method is its all done in 1 MySQL query and its secure!

Group 0 is a Registered user, Group 1 an Admin and Group 2 is a Moderator
Code:
group_id | request_uri | is_admin

1   |   /            |   1
2   |   /home        |   1
0   |   /home/news   |   0

Using "/" will work across ALL controllers. It's wise to use this carefully as it gives global access to view any controllers that require any authentication.

There is some code examples here.

 

Summary

CL Auth comes bundled with the most requested features for a login system straight out of the box. The library is condensed but flexible enough to extend with your own features.

The download comes with an example to help you get started.

Credit to others makers of Auth Systems on the CI Forums. Especially FreakAuth which inspired a lot of the features.
Any snippets of code that have been modified or borrowed are credited with comments in the code.

***

PHP4 Users Note! This has only been tested with PHP5. If you are using PHP4 let me know if it works (I believe it should, I have used PHP4 methods).
MCRYPT MODULE MUST BE ENABLED in your php.ini to use the password encryption.

 

F.A.Q

What do I need to be able to run CL Auth?
You need PHP5, MySQL and MCrypt Module (a standard module that comes with PHP).

What libraries are needed to use CL Auth?
CL Auth comes bundled with the necessary libraries and schema's. You will need to run the custom "DB Session" that comes with it as its customised for CL Auth.

How fast is CL Auth?
Very fast! Models, helpers and libraries are only loaded when they are needed. The end result is fewer queries and less memory hogging.

Why did you make CL Auth? Theres hundreds of other Auth Systems isn't there?!
Yes I know. I am a frequent visitor of CI and have browsed a lot of code, but I am somewhat a bit of a perfectionist. I had this brilliant idea for a new ACL but the other libraries were too constricted, so I ended up writing my own improving on other peoples idea with CodeIgniter 1.6.1 in mind.
The aim was to make a optimised, lightweight auth library.

Is CL Auth compatible with 1.6.1?
Absolutely! It was built on 1.6.1 making it the most up to date Auth System around!
UPDATE: CL Auth v0.1 is compatible with CodeIgniter 1.6.2 and now 1.6.3

Is CL Auth backwards compatible with other CodeIgniter versions?
In theory, yes. There are no functions within CL Auth that prevent it from being locked down. It *should* work with 1.5.x but this hasn't been tested.

Does CL Auth come with an admin panel?
No. Simply I think it's a waste of time to build an admin panel for this library. If you want one, you are going to have to build it yourself, sorry.
#2

[eluser]gunter[/eluser]
please, do you can give me a hint how the URI Auth management works?
#3

[eluser]FlashUK[/eluser]
[quote author="gunter" date="1209843492"]please, do you can give me a hint how the URI Auth management works?[/quote]

It works by checking the controller and action. e.g:

"/home/news"

It would check the table group_uri for 3 types:

"/" top level access to everything
"/home" the name of the controller
"/home/news" the name of the controller and action

If it finds a record that matches for that usergroup, it will allow access to that page.

This is what a typical mysql table might look like for group_uri:
Group 0 is a Registered user, Group 1 an Admin and Group 2 is a Moderator
Code:
group_id | request_uri | is_admin

1   |   /            |   1
2   |   /home        |   1
0   |   /home/news   |   0

Edit: I have updated the main article with this information.
#4

[eluser]wonderbread[/eluser]
I'm not sure if I've missed something but I get the error;
Code:
The configuration file cl_auth.php does not exist.
I checked the files I downloaded and it's nowhere to be seen. Is it just me?
#5

[eluser]FlashUK[/eluser]
[quote author="wonderbread" date="1209907810"]I'm not sure if I've missed something but I get the error;
Code:
The configuration file cl_auth.php does not exist.
I checked the files I downloaded and it's nowhere to be seen. Is it just me?[/quote]

Sorry, I had forgotten to include the config file in the zip. I have reuploaded the file now.
#6

[eluser]flosaurus[/eluser]
Thanks a lot for this script ! works like a charm Smile

Anyway, my php knowledge is pretty basic and i would like to know how i can retrieve logged user information such as his unique id ?

Thank you for your answers
#7

[eluser]Tom Glover[/eluser]
Nice add-on to the community, i have added it to my blog along with the other ACLs and Auths out there..
#8

[eluser]FlashUK[/eluser]
Thanks for your support guys!

flosaurus: If you want to grab the current username use $this->cl_auth->getUsername(). If you want the users ID use either $this->cl_session->userdata('user_id') or the preferred method $this->cl_session->userdata('session_user_id');

If you want to check if the user is logged in regardless of their ID use $this->cl_auth->isValidUser(); (this is part of the "isWhatever" functions located in the library).

WackyWebs.net: Thank you for posting this on your blog, I am sure it will help improve peoples awareness of this library Smile

Checkout the captcha plugin that comes with it, "cl_captcha_pi". It is standalone and customisable.
It might be helpful if you need a captcha on submitting forms. Read the file to find instructions inside it! Based on phpBB 3 captcha functions.
#9

[eluser]zenonn[/eluser]
Hi
I just downloaded CL Auth v0.1, and when I use the register example I get a "Your confirmation code has expired. Please try again." Any suggestions?
#10

[eluser]FlashUK[/eluser]
[quote author="zenonn" date="1210189443"]Hi
I just downloaded CL Auth v0.1, and when I use the register example I get a "Your confirmation code has expired. Please try again." Any suggestions?[/quote]

This happens if you do not fill in the registration form within 3 minutes (default). It can also happen if you do not have cookies enabled. Try extending the captcha timeout in the config file or fill in the form faster Tongue

If that doesn't work, post back here and I will try to find out the answer for you.




Theme © iAndrew 2016 - Forum software by © MyBB