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.

DX Auth 1.0.6 (Authentication library)

December 01, 2008 6:14am

Subscribe [160]
  • #151 / Dec 13, 2008 12:41am

    hugle

    289 posts

    Hello.
    first of all - thanks for this auth library.
    Main reason I have chosen it - features I need.
    Easy-to-read/edit code.

    All seems fine, but it seems it doesn’t have config option, to disable password encryption?

    Thank you so much!

  • #152 / Dec 13, 2008 4:23am

    dexcell

    142 posts

    ^
    No, i don’t plan to add config to disable password encryption.

    But if you still want it, you can open DX_Auth.php
    Search function _encode($password)

    Delete the code in that function, and replace it with ‘return $password;’

    Should be no problem.

  • #153 / Dec 13, 2008 6:19am

    Paul Apostol

    43 posts

    Hello,
    There is any advantage that the user session data is set under the root of the session and not under a certain key?
    Thanks,
    Paul

  • #154 / Dec 13, 2008 2:09pm

    Ryan Pharis

    4 posts

    Can you see any SMTP things in DX Auth library? I can’t, really. Configure your server and codeigniter first, please.

    If you are using PHP under Windows, mail() function will work over SMTP by default.

    [mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port = 25

    So think twice, post once, please.

    Thanks for the tip RH. I’ve never run into this problem before on windows localhost. I’ll look into it further.

  • #155 / Dec 13, 2008 10:12pm

    dexcell

    142 posts

    Hello,
    There is any advantage that the user session data is set under the root of the session and not under a certain key?
    Thanks,
    Paul

    Actually, in my opinion there is no advantage, it was only for easy coding.
    I know it may overwritten if someone using the same key, maybe i’m gonna add prefix DX_ in user session data used by DX_Auth.

  • #156 / Dec 14, 2008 6:03pm

    Xeoncross

    350 posts

    Darn, it looks like that the pass several weeks of reviving the Redux Auth system are toast - you already have a system that does what I built - and more!

    I wish that you would have mentioned something about this back in October! Oh well, at least this system exists now!

    Question: Why do you store the email templates in language files? Why don’t you place them in views/auth/email/ so that we can change them depending on the template and we don’t have to mess with HTML in our config variables. Also, even though you are using HTML links in the language files - you don’t have a doc type defined or anything. Isn’t that bad practice?

  • #157 / Dec 14, 2008 7:44pm

    Johan André

    412 posts

    Thanks for this great library!

    It really speeds up development. I’m coding a site with 3000+ users with different roles and it works like a charm! 😊

    I don’t know if it is a bug but I found that the is_role() does not search the parent roles of a user.

    My roles are setup like this:

    User
      Band
        Band1
        Band2
        Band3
        etc…

    When I run is_role(‘band’, TRUE) it returns false. Am I doing it wrong?

    I did a quick fix for it:

    //
    // Added these methods to DX_Auth.php
    //
    function get_role_names()
    {
        return $this->arraytolower($this->ci->session->userdata('parent_roles_name'));
    }
        
    function arraytolower($array,$round = 0){
        foreach($array as $key => $value){
             if(is_array($value)) $array[strtolower($key)] =  $this->arraytolower($value,$round+1);
             else $array[strtolower($key)] = strtolower($value);
        }
        return $array;
    }
    //
    // ... and this snippet right before the return-statement in the is_role() method.
    //
    foreach ($roles as $val)
    {
        if (in_array(strtolower($val), $this->get_role_names() ))
        {
             $result = TRUE;
             break;
        }
    }

    Is there another way to do it?

  • #158 / Dec 15, 2008 12:13am

    dexcell

    142 posts

    Question: Why do you store the email templates in language files? Why don’t you place them in views/auth/email/ so that we can change them depending on the template and we don’t have to mess with HTML in our config variables. Also, even though you are using HTML links in the language files - you don’t have a doc type defined or anything. Isn’t that bad practice?

    It was to support internationalization.
    It’s ok, because CI using mailtype text as default for sending email, if you want to use html, then you may want to change it.

  • #159 / Dec 15, 2008 12:15am

    dexcell

    142 posts

    Thanks for this great library!

    It really speeds up development. I’m coding a site with 3000+ users with different roles and it works like a charm! 😊

    I don’t know if it is a bug but I found that the is_role() does not search the parent roles of a user.

    My roles are setup like this:

    User
      Band
        Band1
        Band2
        Band3
        etc…

    When I run is_role(‘band’, TRUE) it returns false. Am I doing it wrong?

    I did a quick fix for it:

    //
    // Added these methods to DX_Auth.php
    //
    function get_role_names()
    {
        return $this->arraytolower($this->ci->session->userdata('parent_roles_name'));
    }
        
    function arraytolower($array,$round = 0){
        foreach($array as $key => $value){
             if(is_array($value)) $array[strtolower($key)] =  $this->arraytolower($value,$round+1);
             else $array[strtolower($key)] = strtolower($value);
        }
        return $array;
    }
    //
    // ... and this snippet right before the return-statement in the is_role() method.
    //
    foreach ($roles as $val)
    {
        if (in_array(strtolower($val), $this->get_role_names() ))
        {
             $result = TRUE;
             break;
        }
    }

    Is there another way to do it?

    Thank you 😊
    It was my mistake. Sorry, i forgot to update is_role function when i add inheritance feature.
    I will update it in next release.

  • #160 / Dec 15, 2008 1:52am

    jaswinder_rana

    89 posts

    Few small things

    - In your backend views, you are using <? rather than <?php. It doesn’t work by default unless you have short tags open

    - Even though nothing is returned, but if someone knows that I am using DXAuth library, they can use those check functions via URLs. Not sure if that would make any security threat since it doesn’t do anything but still making those functions private (I think by adding _ in front of them?) maybe more secure


    A feature request

    I am asking this to see if this is being worked on as I don’t want to re-invent it if it is.

    I was wondering if you plan to add more functionality. Few things that’d really hit the spot are:

    - Profile change page for BOTH auth and backend (backend for ALL users as that is admin spot)
    - Edit logged in user information in BOTH auth and backend (backend for ALL users as that is admin spot (I think)
    - Changing user roles


    If there are no plans in future then I can go ahead and do it for my site. If there are then I can wait and use your code.

    My preference if to use your code as that way I can easily update it for newer versions.

    Sorry for being a demanding (and lazy) user. I liked this library and started using it this week (along with CI). Thanks

  • #161 / Dec 15, 2008 2:22am

    dexcell

    142 posts

    Few small things

    - In your backend views, you are using <? rather than <?php. It doesn’t work by default unless you have short tags open

    Thanks.

    - Even though nothing is returned, but if someone knows that I am using DXAuth library, they can use those check functions via URLs. Not sure if that would make any security threat since it doesn’t do anything but still making those functions private (I think by adding _ in front of them?) maybe more secure

    Do you mean the callback function in Auth.php?
    Well, you can use _remap function to disable that.

    A feature request

    I am asking this to see if this is being worked on as I don’t want to re-invent it if it is.

    I was wondering if you plan to add more functionality. Few things that’d really hit the spot are:

    - Profile change page for BOTH auth and backend (backend for ALL users as that is admin spot)
    - Edit logged in user information in BOTH auth and backend (backend for ALL users as that is admin spot (I think)
    - Changing user roles


    If there are no plans in future then I can go ahead and do it for my site. If there are then I can wait and use your code.

    My preference if to use your code as that way I can easily update it for newer versions.

    Sorry for being a demanding (and lazy) user. I liked this library and started using it this week (along with CI). Thanks

    Sorry, i don’t plan to add more feature in backend at current time, since it was just an example, but maybe someday in the future.

    But actually, i believe current functions in the DX Auth Model can fulfill your request.

    And if you don’t mind, you can contribute by posting more advanced backend 😊

  • #162 / Dec 15, 2008 2:55am

    dexcell

    142 posts

    Added small update to 1.0.4, to add check parent in is_role function, and few small changes.

  • #163 / Dec 15, 2008 6:57am

    RaF007

    9 posts

    A small remark for this wonderful library:

    Using DX Auth in a project of mine. After uploading the project to my webserver I kept on getting an error message saying dx_auth couldn’t be loaded. Eventually I found out that the capitalized name of the file ‘DX_Auth.php’ was causing the problem.

    I suppose some webservers are case-sensitive while others are not. A small suggestion from me would be to rename the files to Dx_auth.php/Dx_auth_event.php to prevent this error from occuring when run on case-sensitive webservers.

  • #164 / Dec 15, 2008 8:54am

    jaswinder_rana

    89 posts

    Sorry, i don’t plan to add more feature in backend at current time, since it was just an example, but maybe someday in the future.

    But actually, i believe current functions in the DX Auth Model can fulfill your request.

    And if you don’t mind, you can contribute by posting more advanced backend 😊

    Thanks. I’ll see what I come up with and will share it here when done

  • #165 / Dec 15, 2008 4:55pm

    Iverson

    153 posts

    Great Lib. One thing though… After a successful login as a normal user, if I go to the backend’s url, it throws an error. Users shouldn’t know the url to your backend anyway, but just an fyi…

    A PHP Error was encountered

    Severity: Warning

    Message: in_array() [function.in-array]: Wrong datatype for second argument

    Filename: libraries/DX_Auth.php

    Line Number: 172

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

ExpressionEngine News!

#eecms, #events, #releases