Part of the EllisLab Network
   
10 of 11
10
The Easiest Authentication Library for CodeIgniter just got easier.
Posted: 24 June 2009 10:23 AM   [ Ignore ]   [ # 91 ]  
Summer Student
Total Posts:  13
Joined  03-12-2009

Hi Adam

Smooth library you have here.

One question: I’m trying to show a form_validation error (on the login page), rather than showing a CI error message when the user enters the correct username, but the incorrect password.

I understand that the purpose of this is for security reasons, but it has usability issues with my application.

So the section of code that it concerns is:

if(!$this->_verify_details($auth_type, $username, $password))
{
   show_error
($this->CI->lang->line('login_details_error'));
}

My understanding is that I will need to make the method verify_details public, and move it to MY_Controller - is there a more elegant solution?

Thanks

Profile
 
 
Posted: 26 June 2009 01:25 PM   [ Ignore ]   [ # 92 ]  
Summer Student
Total Posts:  3
Joined  07-08-2007
Think Floyd - 24 June 2009 10:23 AM

One question: I’m trying to show a form_validation error (on the login page), rather than showing a CI error message when the user enters the correct username, but the incorrect password.

I am having the same issue. I’ve been trying to figure it out for days now. The standard form validation “username/password length&required;, as well as checking if the username exists works just fine, but if the password is invalid, it shows the CI Error page, which is inconvenient.

Any help?

Profile
 
 
Posted: 26 June 2009 06:03 PM   [ Ignore ]   [ # 93 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  349
Joined  05-04-2008

libraries/Auth.php Line 140.

Simple change show_error($this->CI->lang->line(‘login_details_error’)); for any other method of showing an error. I will fix this soon.

Thanks.

 Signature 

[ Adam Griffiths - Shropshire Based Web Developer ]
[ The Authentication Library User Guide ]
[ Programmers Voice - PHP and CodeIgniter articles, tutorials and screencasts. ]
[ Follow me on Twitter ]

Profile
 
 
Posted: 27 June 2009 02:00 PM   [ Ignore ]   [ # 94 ]  
Grad Student
Rank
Total Posts:  93
Joined  04-13-2009

somebody might find this useful

I added this function to helpers/auth_helper.php

function groupname()
{
    $CI
=& get_instance();
    return
array_search($CI->session->userdata('group_id'), $CI->auth->config['auth_groups']);
}

I use it in my views/dashboard.php file as follows:

<h2>Dashboard for <?= username() ?> - <?= groupname() ?> </h2>;

The output is

Dashboard for seanloving - editor

instead of

Dashboard for seanloving - 2

Maybe there is an even simpler way?

—Sean Loving

Profile
 
 
Posted: 01 July 2009 05:45 AM   [ Ignore ]   [ # 95 ]  
Grad Student
Avatar
Rank
Total Posts:  49
Joined  11-15-2006

1. Is there a way to send a user who is logging in to a different login page (view), instead of the Admin login page? I would like a user login page that fits my own site’s template.

2. I would also like help figuring out how to create a “pass-through” feature: say you land on the URI /member/account/ and you are not logged in. I would like the login form to display, and upon successful login, you are just passed-through to the current URI. If you are already logged in, you just get passed right through as well.

Thank you.

 Signature 

Travis Cable
Web Developer
http://www.beperpetual.com

Profile
 
 
Posted: 01 July 2009 12:21 PM   [ Ignore ]   [ # 96 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  349
Joined  05-04-2008
Nexus Rex - 01 July 2009 05:45 AM

1. Is there a way to send a user who is logging in to a different login page (view), instead of the Admin login page? I would like a user login page that fits my own site’s template.

2. I would also like help figuring out how to create a “pass-through” feature: say you land on the URI /member/account/ and you are not logged in. I would like the login form to display, and upon successful login, you are just passed-through to the current URI. If you are already logged in, you just get passed right through as well.

Thank you.

The first point you made is somewhat difficult. But then again depending on your needs it could be fairly simple. If you want to have the login page on your website rather than in the admin section, then you should open up libraries/Auth.php — find the login() function and change the call to the login view so the function $this->view(); is not used and $this->load->view() is used instead.

If you want to have both the login on your website and in the admin panel. You’ll need to copy the login() function — rename it and then do the above so you load a different view file. Hopefully I am clear enough for you on this one.

With your second point, if you have the following code in your member controller.

function account()
{
    
if(logged_in())
    
{
        
// show the logged in view stuff
    
}
    
else
    
{
        $this
->auth->login('member/account/');
    
}
}

This would then redirect the user back to that page.


Thanks.

 Signature 

[ Adam Griffiths - Shropshire Based Web Developer ]
[ The Authentication Library User Guide ]
[ Programmers Voice - PHP and CodeIgniter articles, tutorials and screencasts. ]
[ Follow me on Twitter ]

Profile
 
 
Posted: 03 July 2009 09:29 AM   [ Ignore ]   [ # 97 ]  
Grad Student
Rank
Total Posts:  89
Joined  10-26-2006

Hello Adam,

  sorry if this question has already been made by someone else, that’s too many pages to search every one and find an answer.

  I have a project that will need more user groups that the 3 that you planned in the auth lib, can I just insert more groups in the auth.php file or create it in the db?

  Thanks, and congrats for the nice piece of code smile

RA

 Signature 


RA

rafael apocalypse
ideiadigital.org

Profile
 
 
Posted: 04 July 2009 12:12 PM   [ Ignore ]   [ # 98 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  349
Joined  05-04-2008
rafael apocalypse - 03 July 2009 09:29 AM

Hello Adam,

  sorry if this question has already been made by someone else, that’s too many pages to search every one and find an answer.

  I have a project that will need more user groups that the 3 that you planned in the auth lib, can I just insert more groups in the auth.php file or create it in the db?

  Thanks, and congrats for the nice piece of code smile

RA

You will need to add it into the config file for The Authentication Library. Adding it into the database is optional at this point bt in future versions there will be a utility to add groups.

Thanks,
Adam

 Signature 

[ Adam Griffiths - Shropshire Based Web Developer ]
[ The Authentication Library User Guide ]
[ Programmers Voice - PHP and CodeIgniter articles, tutorials and screencasts. ]
[ Follow me on Twitter ]

Profile
 
 
Posted: 04 July 2009 08:01 PM   [ Ignore ]   [ # 99 ]  
Summer Student
Total Posts:  13
Joined  03-25-2009

I’m having a really strange problem. I’ve used this library in the past, but when implementing it now I keep getting an error;

“An Error Was Encountered

The configuration file auth.php does not exist.”

The problem is, that the auth.php file is actually named Auth.php with a capital ‘A’. If I rename it to ‘auth’ with a lower-case ‘a’ it works. Just thought I’d let you know.

 Signature 

[ upbeat.no - coming soon ]

Profile
 
 
Posted: 09 July 2009 05:01 AM   [ Ignore ]   [ # 100 ]  
Summer Student
Avatar
Total Posts:  3
Joined  05-01-2009

there is a wrong quotes in /library/Auth.php line 359

Profile
 
 
   
10 of 11
10
 
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 819, on March 11, 2010 11:15 AM
Total Registered Members: 119840 Total Logged-in Users: 62
Total Topics: 125973 Total Anonymous Users: 3
Total Replies: 662716 Total Guests: 535
Total Posts: 788689    
Members ( View Memberlist )