Forum Replies Created

Viewing 15 replies - 61 through 75 (of 574 total)
  • Plugin Author tbenyon

    (@tbenyon)

    Hey @abhishekmanne,

    I am working on a pro version of the plugin and I am planning for this to be a future feature of that.

    I’ll mark this as resolved for now but will come back to these threads to update once the feature is added.

    For now you could write your own hook into for when passwords get update to make an additional query to your external database to update the password hash.

    Thanks,

    Tom πŸ™‚

    Plugin Author tbenyon

    (@tbenyon)

    I haven’t heard back so I’m going to assume this solved your problem.

    If you have any more questions, please don’t hesitate to get back in contact.

    Thanks,

    Tom πŸ™‚

    Forum: Plugins
    In reply to: [External Login] ssha256
    Plugin Author tbenyon

    (@tbenyon)

    I haven’t heard back from you so I’m going to mark this as resolved.

    If you have any questions in the meantime, please don’t hesitate to get back in contact.

    Kind regards,

    Tom πŸ™‚

    Plugin Author tbenyon

    (@tbenyon)

    Hey @intlabnz,

    I have completed this work for you.

    There is now a hook that allows you to do what you want to do, and all you’ll need to do is write your own query based on the structure of your personal database.

    The hook provides you with a range of different information:
    $roles – the array of roles already mapped using the built in logic based on data set it the admin panel
    $username – the username that was typed in the login screen
    $userData – the data that was originally queried for the user

    It is expected that you will return an array of roles.

    The below example assumes that you want to use the roles derived from the built in logic and add to it.
    For this reason new roles are added onto the passed array and that is returned.
    If you want to ignore what the logic currently provides you could simply pass a new array.

    The example uses some built in functionality to the plugin to help you build your query. You may prefer to write a more basic query just using text.

    
    function myExlogRolesMapper($roles, $username, $userData) {
        // Uses the data provided to the plugin to create the database object and data required for a query
        $db_data = exlog_get_external_db_instance_and_fields();
    
        // Start building a query to fetch the user
        // This is the first bit you will want to modify to select data from your additional table where the role is being stored
        $query_string =
            'SELECT *' .
            // This is specifying the table specified in the settings panel, you can hard code these if you rather
            ' FROM ' . esc_sql($db_data["dbstructure_table"]) .
            // This finds the correct user based on the username field set in the settings and the username that they typed in
            ' WHERE (' . esc_sql($db_data["dbstructure_username"]) . '="' . esc_sql($username) . '"';
    
        if ($db_data["dbstructure_email"]) {
            // Because the username they type in can be an e-mail, if you have set an e-mail field in the settings panel we will also try and find the user by e-mail
            $query_string .= ' OR ' . esc_sql($db_data["dbstructure_email"]) . '="' . esc_sql($username) . '")';
        } else {
            $query_string .= ')';
        }
    
        // Use the above computed query actually fetch the data
        $rows = $db_data["db_instance"]->get_results($query_string, ARRAY_A);
    
        // Checking if a user was found
        if ($rows && count($rows) > 0) {
            $foundData = $rows[0];
            // If the custom field in your database called 'myCustomRoleField' has 'editingKing' stored in it
            if ($foundData['myCustomRoleField'] == 'editingKing') {
                // Add the wordpress role 'editor' to the user
                array_push($roles, "editor");
            }
        }
    
        // return the array of roles as WordPress supports multiple roles in the backend even though their settings pane only shows one
        return $roles;
    }
    add_filter('exlog_hook_filter_assign_roles', 'myExlogRolesMapper', 10, 3);
    

    I’m going to mark this as resolved as I’ve now provided this hook as discussed, but if you have any more questions, please don’t hesitate to get back in contact πŸ™‚

    Let me know how you get on!

    Thanks,

    Tom πŸ™‚

    Plugin Author tbenyon

    (@tbenyon)

    Hey @leifharmsen,

    This is now deployed.

    Could you please test the new version and let me know if this has resolved your issue.

    Thanks,

    Tom πŸ™‚

    Plugin Author tbenyon

    (@tbenyon)

    Hey Leif,

    Thanks for the beer encouragement.

    Good news, I’ve found the source of the problem πŸ™‚

    Thanks for flagging this.

    I need to do some tidying up and preparation for the release but I’ll make sure it goes out today.

    Will let you know once the fix is released πŸ™‚

    Thanks again for sharing and for the beers πŸ™‚

    Tom

    Plugin Author tbenyon

    (@tbenyon)

    Hey @leifharmsen,

    Thanks for flagging. Just wanted to acknowledge the message and let you know I’m going to look at this tomorrow.

    Thanks,

    Tom πŸ™‚

    Plugin Author tbenyon

    (@tbenyon)

    Hey @intlabnz,

    I will start work on adding the hook for you in the next couple of weeks πŸ™‚

    Feel free to come back and check up on me if you haven’t heard any more in two weeks time but I will try and update you also πŸ™‚

    Thanks,

    Tom

    Plugin Author tbenyon

    (@tbenyon)

    Hey @intlabnz,

    Unfortunately the answer to your question is, the plugin does not currently support this.

    I am working on a pro version of the plugin and support for this is on my list of ideas but that is a long way off.

    I have two suggested solutions for now:

    Add a hook
    I could add a hook into the plugin allowing you to override the logic for fetching the role.

    Then you could write the logic to query your database.

    I would provide the connections details into the hook so you could use those settings to make the query. I can send an example with an example query.

    This would still require me to schedule in the time to add the hook. My day job is busy at the moment so could be a few weeks πŸ™

    Hack the plugin
    Basically either yourself or pay for a developer to modify the code for the plugin to do what you want. Work on this could start immediately however everytime the plugin gets updated you’d need to re-integrate these changes.

    This is not a very good solution but just wanted to give you options.

    Let me know your thoughts.

    Thanks,

    Tom

    Plugin Author tbenyon

    (@tbenyon)

    Hey @jucylucy,

    The plugin does not currently support this out of the box, however it is possible.

    If you were comfortable writing the logic you could prevent the core hook from firing using the the following line:
    remove_filter('authenticate', 'exlog_auth', 10, 3);

    I must admit I have not tested this. I wanted to do a quick check for you before sending but it has gotten late, my brain is fried and I wanted to get you an initial response out.

    The line of code could be used whenever you wanted to fall back to the default authentication method.

    If however, this is something you’d need help with I can add it to my feature request list.

    Let me know if you have any more questions πŸ™‚

    Thanks,

    Tom

    Plugin Author tbenyon

    (@tbenyon)

    Hey @chuckmo,

    No need to apologise πŸ™‚

    I think I understand what you mean. I presume you’re talking about this line:
    $user = $userobj->get_data_by('login', $response['wp_user_data']['username']);
    …which I think in your case you find fixes your issue if you change it to the following…
    $user = $userobj->get_data_by('email', $response['wp_user_data']['username']);.

    I am surprised this doesn’t work as already I would expect searching by ‘login’ to be the username would also work as $response['wp_user_data']['username'] should have been set to be the e-mail and $userobj->get_data_by('login' would be looking for the username which would be an e-mail address.

    To be honest I’m not sure I’m going to have time to look at this at the weekend so it may be the following one.

    Does that work for your are you in desperate need of this?

    Thanks,

    Tom πŸ™‚

    Plugin Author tbenyon

    (@tbenyon)

    Hey @vartolomej,

    The current feature set will yes 😊

    There are pro features in the pipeline that will require write privileges but for now, you’re good 😊

    Plugin Author tbenyon

    (@tbenyon)

    Hey @ketr64,

    I really appreciate you taking the time to write a review 😊

    Good luck with your project 😊

    Tom

    Plugin Author tbenyon

    (@tbenyon)

    Hey @anand_jodawat,

    I really appreciate you taking the time to write a review.

    Do keep me posted if you get any more information on how your external system is hashing passwords and I’ll be happy to help you further πŸ™‚

    Thanks again,

    Tom

    Forum: Plugins
    In reply to: [External Login] ssha256
    Plugin Author tbenyon

    (@tbenyon)

    Sorry to bombard you but I had one final punt at this and I would expect the following to display a deconding with valid characters and it doesn’t.

    
    <?php
    $prefix = "{SSHA256}";
    
    $dbHash = '{SSHA256}JVCmnFjLqYvJJLPKfhG7a6KFaa6JmrEeg8mhTkYqWIljOGMzZmE1OTlhNjE0NzY5';
    
    echo base64_decode(
                preg_replace("/" . $prefix . "/i", "", $dbHash)
            );
    

    You can copy and paste the code and try it yourself but this is the output I’m getting:
    %PοΏ½οΏ½XΛ©οΏ½οΏ½$οΏ½οΏ½~οΏ½kοΏ½οΏ½iοΏ½οΏ½οΏ½οΏ½οΏ½Ι‘NF*XοΏ½c8c3fa599a614769

Viewing 15 replies - 61 through 75 (of 574 total)