Since I released the QuickAuth authentication library for Codeigniter almost a year ago I haven’t really had that much time to maintain it, and thus it has fallen slightly to the way side.
In order to put this right, and to add some extended functionality to one of the lightest Codeigniter libraries around I’ve spent the last twenty four hours rebuilding the library from the ground up, and have included a simple User Interface helper that is great for displaying notices using session flash data to your users. I’ve labelled this version V2 as it’s a complete rebuild of the library, and although it works in much the same way, it definitely isn’t a drop in replacement for older versions of the library.
You can download the library and supporting UI helper from git hub, either by using Git or downloading a tar/zip file of the repository using the interface provided on the GitHub.com link below.
git://github.com/syntaxmonster/Codeigniter-Authentication-Library.git
Or
http://github.com/syntaxmonster/Codeigniter-Authentication-Library
I’ve decided not to attach a zip archive of the code to this post so that it’s easier for people to locate the current version of the code.
If you have any instructions then please don’t hesitate to leave me a comment and I hope to follow this post up with a tutorial this Friday.
Hey Dave,
Thanks for the awesome script. Just a couple notes on your update:
a) The encryption key must be set (this is a valid expectation)
b) the column in the Registration function is looking for ‘firstname’, however you specified ‘fullname’ as the column name in the SQL file to create the database.
c) The encrypt function in the quickauth file is set to call from $ci->, but it needs to be $this->ci in order to work (the rest in the file seem to work properly)
That’s all for now!
Thanks Craig. Couple of things that managed to slip through my proof reading there! I’ve made the relevant changes and committed them to Git as V2.1.
Dave
Thanks Dave, looks good.
There’s a couple things that I’ve been figuring out that aren’t documented (trying to register with/without the $type being in the array) but things are going well and this is saving loads of time.
Craig,
I had entirely forgotten about the $type for setting up initial groups in the registration whilst documenting the library. I was actually toying with the idea of having it assign the group designated as the default group unless otherwise specified (So basically, if the $type isn’t specified.) What do you think as if I’m not the only person who thinks it’d be ideal I’ll add the idea tonight.
Dave,
I think that makes more sense.
What I did was remove the array completely so I am only specifying a single TYPE of user (it broke the array before, as there was no alternative). I think that adding an argument that is more flexible is a great idea, and I will update to that code if you end up doing that.
I have also been looking to modify your register() function to enable autologin (once registration is complete the user is already logged in), however it doesn’t seem to work for me yet. Will look into it more soon! Thanks again for an awesome piece of code.
Hi Craig,
I’ve added your code to the logout function and have also modified the register function so that it will insert in to a default group, and should hopefully automatically login after a successful registration. Check out Github to get the new code!.
Dave,
Awesome!
Thanks again Dave, this is going to shape up to be one heck of a useful file.
I don’t actually see the update on GIT, I still see a 3 day old file. I don’t use the actual GIT though, I just download the source (if that makes a difference).
Congrats on the new release, dave!
Pingback: Top codeigniter libraries I can't live without. | John Hamelink
Dude.. how to use this library? No guide no tutorial.. pain in ass.
Mike,
As I said, a small guide is coming in the next few days. I planned to release it on Friday although work hasn’t allowed me to do this unfortunately. That said, the library isn’t that hard to use, and I still plan to release a user guide in the coming couple of days.
Dave
I will be waiting,
Thx a lot for ur efforts,
Thanks Nick,
As of last night there is actually some limited documentation in the Git repository. Hope it can help you figure out the lib whilst I work on something better. Also, if you do need any help, just use the contact form to get in touch.
Dave,
Couple other things: (you can email me at any time to take this conversation away from the comments)
1) Session Destroy was called incorrectly in the logout system –
replaced
a) $this->ci->session->destroy();
WITH
b) $this->ci->session->unset_userdata(‘userid’);
(the actual session destroy is sess_destroy, but it doesn’t seem to work in this instance)
Second thought, a really easy function to add that will likely come in handy (unless I missed where this has been referenced):
//Return the user id
function user_id()
{
$id = $this->ci->session->userdata(‘userid’);
return $id;
}
Just my two cents,
Craig Hooghiem
Another side note:
All the references to $ci-> in the restrict() function are also incorrect. All need to be $this->ci
And also (sorry for so many comments), the restrict function has:
$userid = $this->ci->session->userdata(‘userid’);
$ci->db->where(‘userid’, $id);
Which is declaring $userid and then trying to reference $id
Last one for today, I promise:
restrict function also references the row, and the tries to grab ‘name’, but in your SQL you specify the table column as ‘title’
`title` varchar(20) NOT NULL DEFAULT ”
Pingback: John Hamelink’s Blog: Top codeigniter libraries I can’t live without. | Development Blog With Code Updates : Developercast.com
Pingback: John Hamelink’s Blog: Top codeigniter libraries I can’t live without. | PHP
Pingback: John Hamelink’s Blog: Top codeigniter libraries I can’t live without. | PHP