Welcome Guest, Not a member yet? Register   Sign In
The Easiest Authentication Library for CodeIgniter just got easier.
#91

[eluser]Adam Griffiths[/eluser]
The Authentication Library has now been updated to version 1.0.6. This brings a number of changes to the library and fixes a few bugs. Please consult this thread for details of the changes and how to submit bugs.

Thanks.
#92

[eluser]Think Floyd[/eluser]
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:

Code:
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
#93

[eluser]XonnoX[/eluser]
[quote author="Think Floyd" date="1245875026"]
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.
[/quote]

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?
#94

[eluser]Adam Griffiths[/eluser]
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.
#95

[eluser]seanloving[/eluser]
somebody might find this useful

I added this function to helpers/auth_helper.php

Code:
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:

Code:
<h2>Dashboard for &lt;?= username() ?&gt; - &lt;?= groupname() ?&gt; </h2>;

The output is
Quote:Dashboard for seanloving - editor

instead of

Quote:Dashboard for seanloving - 2

Maybe there is an even simpler way?

--Sean Loving
#96

[eluser]Nexus Rex[/eluser]
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.
#97

[eluser]Adam Griffiths[/eluser]
[quote author="Nexus Rex" date="1246463123"]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.[/quote]

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.

Code:
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.
#98

[eluser]rafael apocalypse[/eluser]
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
#99

[eluser]Adam Griffiths[/eluser]
[quote author="rafael apocalypse" date="1246649388"]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[/quote]

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

[eluser]jabberjab[/eluser]
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.




Theme © iAndrew 2016 - Forum software by © MyBB