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.

Ion Auth - Lightweight Auth System based on Redux Auth 2

February 10, 2010 7:00pm

Subscribe [287]
  • #751 / Feb 03, 2011 5:09pm

    dallen33

    88 posts

    Definitely works with CodeIgniter 2.0.0.

  • #752 / Feb 04, 2011 1:16am

    joytopia

    76 posts

    Definitely works with CodeIgniter 2.0.0.

    But you will need this CI2.0 patch
    https://bitbucket.org/ellislab/codeigniter/issue/252/undefined-method-error-produced-when-using

  • #753 / Feb 04, 2011 6:31pm

    Ben Edmunds

    812 posts

    xatrix,

    I won’t walk you through it completely cause it’s not a simple process but basically I just add the token fields to the meta table and update_user() when I get the token back from the API.

  • #754 / Feb 07, 2011 6:53am

    Ricola

    10 posts

    if i wanna change a db engine from myisam to innodb , what i have to do something before?

  • #755 / Feb 08, 2011 11:18am

    Ben Edmunds

    812 posts

    Ricola,

    Don’t think so.

  • #756 / Feb 08, 2011 11:55am

    benske

    3 posts

    Hello
    Thanks for this library, it’s what I needed!

  • #757 / Feb 08, 2011 2:45pm

    Basketcasesoftware

    442 posts

    Hopefully I’m not repeating a question, but is there a way to integrate this with DataMapper version 1.8 easily? Or is this capability already in place and this is a non-issue? I know Ion Auth is very database dependent. If it is an issue I think I’m up to writing appropriate models.

  • #758 / Feb 10, 2011 9:45pm

    Ben Edmunds

    812 posts

    Basketcasesoftware,

    How do you want to integrate it? 

    The tables should work fine with DataMapper’s expected schemas so if you want to use DM just create the models.

  • #759 / Feb 10, 2011 10:09pm

    Basketcasesoftware

    442 posts

    I’m working with tables with user-configurable distribution across multiple databases/servers. Need that self-contained table model that DataMapper uses because of it.

    I sort of thought along those lines that you mentioned but it’s looking like I’m going to have to rewrite the existing model and the functions you included in them (which I admit you mentioned). May have to make changes in your existing code elsewhere. Thank goodness it’s pretty small and well commented. 😊  I don’t even have a clue what to do with that join field option in you config file as DataMapper handles the joins between tables. I’ve had to side track on other projects but I’ll get around to finishing the rewrites by the end of this weekend. A nice feature is I don’t have to include that code to detect CI versions. I just extend off of the DataMapper object which has already taken care of that already.

    I’ll send you the finished code when I’m done so you see what I’m talking about.

  • #760 / Feb 10, 2011 10:11pm

    Ben Edmunds

    812 posts

    Basketcasesoftware,

    Have fun dude.  Definitely send me a copy when your done, sounds cool.

  • #761 / Feb 11, 2011 12:31pm

    c-s-n

    6 posts

    Hi there,

    I just wanted to give a bit of feedback to the great Ion Auth library. My Version is exactly one week old and downloaded from github. Codeigniter is v1.7.3

    In your example controller you heavily use flashdata. So did i but in conjunction with database sessions.
    When I updated a user and got a duplicate error, the new session data could not be stored in the database, because the transaction was not completed and so the flashdata message stayed empty. So here is the fix:

    ion_auth_model.php

    // After line 838, before return FALSE:
    $this->db->trans_rollback();

    Also I changed the english language file a bit - just writing style, not wanted to keep back from you 😉

    // Account Creation
    $lang['account_creation_successful']            = 'Account successfully created';
    $lang['account_creation_unsuccessful']           = 'Unable to create account';
    $lang['account_creation_duplicate_email']      = 'Email already used or invalid';
    $lang['account_creation_duplicate_username']      = 'Username already used or invalid';
    
    // Password
    $lang['password_change_successful']           = 'Password successfully changed';
    $lang['password_change_unsuccessful']            = 'Password change unsuccessful';
    $lang['forgot_password_successful']           = 'Password reset email sent';
    $lang['forgot_password_unsuccessful']           = 'Password reset unsuccessful';
    
    // Activation
    $lang['activate_successful']                = 'Account activated';
    $lang['activate_unsuccessful']               = 'Unable to activate account';
    $lang['deactivate_successful']                = 'Account deactivated';
    $lang['deactivate_unsuccessful']            = 'Unable to deactivate account';
    $lang['activation_email_successful']            = 'Activation email sent';
    $lang['activation_email_unsuccessful']        = 'Unable to send activation email';
    
    // Login / Logout
    $lang['login_successful']                = 'Logged in successfully';
    $lang['login_unsuccessful']                = 'Incorrect login';
    $lang['logout_successful']               = 'Logged out successfully';
      
    // Account Changes
    $lang['update_successful']               = 'Account information successfully updated';
    $lang['update_unsuccessful']               = 'Unable to update account information';
    $lang['delete_successful']               = 'User deleted';
    $lang['delete_unsuccessful']               = 'Unable to delete user';

    Regards

  • #762 / Feb 11, 2011 12:50pm

    Ben Edmunds

    812 posts

    Thanks c-s-n.  I created a GitHub issue for this and I’ll look into this when I get a chance: http://github.com/benedmunds/CodeIgniter-Ion-Auth/issues/issue/44

  • #763 / Feb 14, 2011 2:25am

    Basketcasesoftware

    442 posts

    Been sidetracked with other stuff this weekend, Ben. I’ll be getting back to that DataMapper version as soon as I can get back on track. Kind of embarrassing really.  :red:

  • #764 / Feb 16, 2011 2:07pm

    c-s-n

    6 posts

    Ok, hi again.

    A bit too often now I looked at some database errors produced by Ion Auth. I’m using PostgreSQL DBMS and you know, this is very restrictive related to data types.

    I know one could/should check for correct types of variables passed to a function - but look at this example:

    $this->ion_auth->get_user_by_identity( $this->session->userdata('my_user') )

    The userdata function returns (bool)FALSE, if - whyever - the key is not existing in the session.
    And then your model tries to compare varchar with boolean…

    The same thing could happen in your model functions, where you also just rely on the correct session variable type.

    To avoid this you should check against the type first in the library, because if done in model and returned NULL, you get things like “Call to a member function row() on a non-object” from library

    So this is, what I did in the library to check the parameter (adapt for other functions):

    public function get_user_by_identity($identity) {
      if(!is_string($identity))
        return null;
      ...
    
    
    public function get_user_array($id=false) {
      if($id !== false && !is_int($id))
        return null;
      ...

    Then one can check with

    is_object(($user = $this->ion_auth->get_user_by_identity( $this->session->userdata('my_user') )))

    if the request was succesful.

    Best regards

  • #765 / Feb 18, 2011 3:26pm

    c77m

    20 posts

    I made the conversion from Tank_auth to Ion_auth last night (which was surprisingly easy).  So far I really enjoy this library, but I ran into a problem today that I can’t track down.

    When loading any page now, I get the following PHP error: Message: Undefined property: Auth::$ion_auth,  Filename: core/Model.php, Line Number: 50

    It’s related to the login session (I logged in last night and checked “Remember me”), but I don’t know where to go to resolve it.  I have the Ion_auth library in my autoload config, and if I delete the identity and remember_me cookies I can log in with everything being normal.

    The CI log for the page load:

    DEBUG - 2011-02-18 13:52:49 --> Config Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Hooks Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Utf8 Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> UTF-8 Support Enabled
    DEBUG - 2011-02-18 13:52:49 --> URI Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Router Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Output Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Input Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Global POST and COOKIE data sanitized
    DEBUG - 2011-02-18 13:52:49 --> Language Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Loader Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Helper loaded: url_helper
    DEBUG - 2011-02-18 13:52:49 --> Helper loaded: text_helper
    DEBUG - 2011-02-18 13:52:49 --> Database Driver Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Config file loaded: application/config/ion_auth.php
    DEBUG - 2011-02-18 13:52:49 --> Email Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Session Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Helper loaded: string_helper
    DEBUG - 2011-02-18 13:52:49 --> Session routines successfully run
    DEBUG - 2011-02-18 13:52:49 --> Language file loaded: language/english/ion_auth_lang.php
    DEBUG - 2011-02-18 13:52:49 --> Model Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Model Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Helper loaded: cookie_helper
    DEBUG - 2011-02-18 13:52:49 --> Helper loaded: date_helper
    DEBUG - 2011-02-18 13:52:49 --> Session class already loaded. Second attempt ignored.
    ERROR - 2011-02-18 13:52:49 --> Severity: Notice  --> Undefined property: Auth::$ion_auth C:\CI\system\core\Model.php 50
    ERROR - 2011-02-18 13:52:49 --> Severity: Notice  --> Undefined property: Auth::$ion_auth C:\CI\system\core\Model.php 50
    ERROR - 2011-02-18 13:52:49 --> Severity: Warning  --> Cannot modify header information - headers already sent by (output started at C:\CI\system\core\Exceptions.php:170) C:\CI\system\libraries\Session.php 670
    DEBUG - 2011-02-18 13:52:49 --> Model Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Model Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> Controller Class Initialized
    DEBUG - 2011-02-18 13:52:49 --> File loaded: application/views/admin/index.php
    DEBUG - 2011-02-18 13:52:49 --> Final output sent to browser
    DEBUG - 2011-02-18 13:52:49 --> Total execution time: 0.1941

    EDIT:

    This seems to be the same error that was referenced in a post last year (http://ellislab.com/forums/viewreply/736434/).  It seems to only happen when I have logged in via multiple browsers and the ci_session cookie has expired.  (I set the Ion_auth cookie to expire after a week, but ci_session expires after two hours by default.)

    I haven’t looked through the code in enough detail to verify the proposed fix is ideal, but I suspect I’ll have to before rollout time.

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

ExpressionEngine News!

#eecms, #events, #releases