Welcome Guest, Not a member yet? Register   Sign In
The Authentication Library 1.0.6
#1

[eluser]Adam Griffiths[/eluser]
I have made some changes to The Authentication Library. Firstly i have fixed some general bugs that led to conflicts between group and group_id throughout the library. I have also implemented some changes that was submitted to me by a user via Github (please post if this was you!!) such as configurable table names and paths to views and models.

If you find any bugs I would appreciate it if you could post them over on the Issue Tracker.

As always all files can be downloaded from the Github repo.

Thanks guys.
#2

[eluser]squarebones[/eluser]
Can't say how well I like this library as I haven't been able to get it working. I followed the installation instructions and all is well until I actually try to access the register function (step 3). There is is no register function in the admin controller. Huh? Nor does login work by entering admin/login. All I get is a 404 page for both. I have renamed my various CI folders, but noted that in the config array so CI knows where to find everything. And my initial controller works to load up a simple construction page, so I know the CI install is good (not my first time using CI, by the way. About my fifth, actually).

I'm kind of stuck now. Is there perhaps something else I need to change to get this working? I know this isn't much information to go on, so ask if you need more to make an educated guess.

Thank you.
#3

[eluser]squarebones[/eluser]
All right. To check this library out thoroughly, I did a clean install of CI 1.7.1 without any extras, and without changing the name of any folders. I set up the config for my MAMP environment (base_url). I get the welcome message. That is good. Means CI is running right.

Now I go through the Library installation again. Copy all the files over. Add the routes defs to the routes.php file. Set up the database locally with standard table names. Just as it should be. And guess what? I still get 404 errors trying to access index.php/admin/register and index.php/admin/login. There's nothering there. The admin controller does not have a method called register or login, so how is this supposed to work? There has to be methods in the controller or CI will throw a 404 each time, or am I not privy to some secret way of getting controllers to load methods that aren't explicity defined in the controller?

That would be neat trick and one I would remember in the future.

So far, this library is a dud. I would really like to get it working as it seems very thorough, though I did find some inconsistencies. Such as... the name of the user and group tables are set in the Auth config file, but in MY_Controller and Usermodel both, the name of the users table is set explicitly in the db queries... can't have it both ways, right? If a user changes the names of the tables in the config file, that blows the functionality of MY_Controller and Usermodel, right? Just checking...

I think maybe something got busted with the update. Perhaps Adam can take a look at his files and figure out what is going wrong and why this thing doesn't appear to work from the outset.

Too bad.
#4

[eluser]Michlis[/eluser]
Same for me. 404 error when trying to register a user...
#5

[eluser]Adam Griffiths[/eluser]
[quote author="squarebones" date="1247183918"]All right. To check this library out thoroughly, I did a clean install of CI 1.7.1 without any extras, and without changing the name of any folders. I set up the config for my MAMP environment (base_url). I get the welcome message. That is good. Means CI is running right.

Now I go through the Library installation again. Copy all the files over. Add the routes defs to the routes.php file. Set up the database locally with standard table names. Just as it should be. And guess what? I still get 404 errors trying to access index.php/admin/register and index.php/admin/login. There's nothering there. The admin controller does not have a method called register or login, so how is this supposed to work? There has to be methods in the controller or CI will throw a 404 each time, or am I not privy to some secret way of getting controllers to load methods that aren't explicity defined in the controller?

That would be neat trick and one I would remember in the future.

So far, this library is a dud. I would really like to get it working as it seems very thorough, though I did find some inconsistencies. Such as... the name of the user and group tables are set in the Auth config file, but in MY_Controller and Usermodel both, the name of the users table is set explicitly in the db queries... can't have it both ways, right? If a user changes the names of the tables in the config file, that blows the functionality of MY_Controller and Usermodel, right? Just checking...

I think maybe something got busted with the update. Perhaps Adam can take a look at his files and figure out what is going wrong and why this thing doesn't appear to work from the outset.

Too bad.[/quote]

To get a few things out of the way first…the MY_Controller.php file has the Application class which has the login and register functions. By extending the Application class all of the Application classes functions are accessible from the admin controller. This is a simple element of Object Oriented programming, so no secret tricks!

As for the database names, the only place I have seen where I have missed using the variable for the database name is the Model. This is a fair point and I'm fixing this issue right no by adding two functions to the helper. The updated helper and model are in the Github repo.

One thing I noticed was that you were navigating to index.php/admin/register when you should just go to index.php/register. Maybe this is the case and hopefully that works for you.

If not I'd appreciate an email off you explaining your setup so I can fix anything on my end if needs be. *email removed*


Thanks.
#6

[eluser]squarebones[/eluser]
Thank you for responding, Adam. I'll try both those things and download your update. I am very interested in getting a good authentication library working for my sites. I have something that Bramme created, and it works, but I was never sure how secure it was. And it isn't as complete as I would like it as it really just checks authorization, rather than providing further authentication functions, as yours does.

Anyway, your's is just one in a string of libraries I have tried, and with no luck with any of them. Like I said, the only library that worked 'as advertised' was Bramme's.

I'll keep you apprised of any progress I make here in the forum, rather than through your e-mail, so that it might help other users of your library.

P.S. Thanks for the glimpse into the workings of MY_Controller. Not having been weaned on OOP, I am used to pure procedural programming, and getting my head around some concepts in OOP is difficult as I feel like it is some sort of black magic. Now I see that using this extension is quite powerful and adds to the flexibility of the framework even more.
#7

[eluser]Michlis[/eluser]
It seems that 404 error was due to incorrect index.php/admin/register instead of just index.php/register, but then you need to update the documentation Wink

However, with the recent two changes from Github I get this error:
Fatal error: Call to undefined function user_table() in C:\wamp\www\freshci\system\application\models\Usermodel.php on line 14

Except of that it seems to work just fine (I hardcoded the user table back again Wink)

One idea I have is to add to the user edit form also possibility to modify user's group_id, since now by default it is 100 and you have to digg in DB to change it.
#8

[eluser]K.Brown[/eluser]
I want to include the login view on my home page and the "$this->load->view('login');".

This is good, and the login form shows, but it can't login. I guess it's restricted to the login view specifically? I'd like this to ajax submit too.

I'm new to CI and PHP...can this be done with your library?

I also want to restrict functions from users who are not logged in.

ie.

Code:
if(user_logged_in()){
do this;
}
else{
do that;
}

Could you help me out?

Thanks!
#9

[eluser]NateL[/eluser]
I added this bit of code to auth_helper.php to get a users ID - I prefer storing ID's and running queries that check against ID's rather than username strings... Hopefully you'll add this to the next release? Smile

Code:
function user_id()
{
    $CI =& get_instance();
    return $CI->session->userdata('user_id');
}
#10

[eluser]2think[/eluser]
Hi Adam,
Interesting solution and trying it out.

In my case on a Fedora Core 9 server, I had to change the config file Auth.php (application/config/Auth.php) to auth.php (application/config/auth.php).

Hope this helps someone else.




Theme © iAndrew 2016 - Forum software by © MyBB