ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

The Easiest Authentication Library for CodeIgniter just got easier.

April 25, 2009 7:12pm

Subscribe [37]
  • #91 / Jun 23, 2009 9:37am

    Adam Griffiths

    316 posts

    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 / Jun 24, 2009 12:23pm

    Think Floyd

    9 posts

    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

  • #93 / Jun 26, 2009 3:25pm

    XonnoX

    3 posts

    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?

  • #94 / Jun 26, 2009 8:03pm

    Adam Griffiths

    316 posts

    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 / Jun 27, 2009 4:00pm

    seanloving

    120 posts

    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

  • #96 / Jul 01, 2009 7:45am

    Nexus Rex

    19 posts

    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 / Jul 01, 2009 2:21pm

    Adam Griffiths

    316 posts

    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.

  • #98 / Jul 03, 2009 11:29am

    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 😊

    RA

  • #99 / Jul 04, 2009 2:12pm

    Adam Griffiths

    316 posts

    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 😊

    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

  • #100 / Jul 04, 2009 10:01pm

    jabberjab

    11 posts

    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.

  • #101 / Jul 09, 2009 7:01am

    boxfrommars

    3 posts

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

  • #102 / Jul 18, 2009 10:56am

    masterkeaton

    1 posts

    I use this librabry with oracle (change every field name to capital, and remove ` from the query).

    But when i use session using database

    $config['sess_use_database'] = TRUE;

    I had a successful login (the session exist on the database) but it keep showing login page.

  • #103 / Jul 23, 2009 6:17pm

    REPOLHO

    1 posts

    Hi…. im new in CI and auth library… not so much in PHP, but i have a dummy question.. how can i create my own form, reading the code, i found the form html as

    <div id="login">
        
        <h2>Login</h2>
    <p>    <div class="box"><br />
                <form method="POST"><br />
                Username/Email:</p>
    
    <p>            <input type="text" name="username" value="<?php echo set_value('username'); ?>" size="50" class="form" /><?php echo form_error('username'); ?></p>
    
    <p><br />
                Password:</p>
    
    <p>            <input type="password" name="password" value="<?php echo set_value('password'); ?>" size="50" class="form" /><?php echo form_error('password'); ?></p>
    
    <p><br />
                <input type="submit" value="Login" name="login" /><br />
                </form><br />
        </div><br />
    </div>

    Normally i would expect an “action” for the form…

    Sorry but im lost, how can i create my own login and register form (it will have a customize database customized)

    Tkz until now.

    Roberto

  • #104 / Aug 18, 2009 11:15am

    Zack Kitzmiller

    175 posts

    Hi…. im new in CI and auth library… not so much in PHP, but i have a dummy question.. how can i create my own form, reading the code, i found the form html as

    <div id="login">
        
        <h2>Login</h2>
    <p>    <div class="box"><br />
                <form method="POST"><br />
                Username/Email:</p>
    
    <p>            <input type="text" name="username" value="<?php echo set_value('username'); ?>" size="50" class="form" /><?php echo form_error('username'); ?></p>
    
    <p><br />
                Password:</p>
    
    <p>            <input type="password" name="password" value="<?php echo set_value('password'); ?>" size="50" class="form" /><?php echo form_error('password'); ?></p>
    
    <p><br />
                <input type="submit" value="Login" name="login" /><br />
                </form><br />
        </div><br />
    </div>

    Normally i would expect an “action” for the form…

    Sorry but im lost, how can i create my own login and register form (it will have a customize database customized)

    Tkz until now.

    Roberto

    That form posts to itself. So if the controller method calling that view is called “auth/login” when the user clicks ‘Submit’ the action will be the controller that called the view. Make sense?

  • #105 / Jan 23, 2010 8:28pm

    atno

    65 posts

    Hi,

    In you user guide you say “You will also need to change your base URL, and other general changes when using CodeIgniter. Please consult the CodeIgniter user guide directly.
    I don’t understand in what have to be changed, would appreciate any help.

    Thanks
    atno

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases