Changing Password in DB

Hello everyone, I'm working on a project that requires to create a different login from the regular login form created by Dolphin, an admin will have a page where it's going to create users (and not the one from boonex also).

When a user is created, I'm generating a password depending on his birth date.

 

The idea is that the user, will know that the password is his birth date with format: yyyy-mm-dd. On his very first login attempt, I will force the user to change his password (I'm using a new column in the profiles table in the DB to keep a record of whether the user has changed before or not). And if it hasn't changed, I will show the user a new view that has the next information:

I have 2 inputs:

Password and password confirmation (I'm validating in frontend and backend)

Finally I will have to update the DB, specifically the Password and Salt fields in the Profiles table.

I'm using basically doing this:

$salt= genRndSalt();

$password = encryptUserPwd($password, $salt); 

Then save to DB:

Update Profiles SET Password='$password', Salt='$salt' WHERE ID='$user_id';
I'm printing the salt and password that it generates for a testing password like: 'qwerty123', and checking on mysql that the values did change.


But when I go back to my login and try to validate with the user and new password ('qwerty123'), It's not validating, at member.php: 

if (check_password($member['ID'], $member['Password'], BX_DOL_ROLE_MEMBER, true, $username))


The Salt is different from the one I generated, I could see this at admin.inc.php. The information received from the getProfileInfo() method is not correct, since the salt does not match with the one I generated. 


// check unencrypted password

function check_password($sUsername, $sPassword, $iRole = BX_DOL_ROLE_MEMBER, $error_handle = true, $username)

{

    $iId = getID($sUsername);

    if (!$iId) return false;

    $aUser = getProfileInfo($iId);

    $sPassCheck = encryptUserPwd($sPassword, $aUser['Salt']);

    return check_login($iId, $sPassCheck, $iRole, $error_handle, $username);

}

 Am I missing something regarding the cookies? or any procedure missing in my between pages that I'm working or updating somehow the profile info?

 

Thanks in advance.

Quote · 17 Mar 2016

Update----

Also in the check_login function, it calls the getProfileInfo function and I'm getting and incorrect salt from the one I got in the DB.

Quote · 17 Mar 2016

i think dolphin salt is slightly different than what you may be using to create a salt. Look in dolphin for the function that creates the salt - and try starting there.

caredesign.net
Quote · 17 Mar 2016

 

i think dolphin salt is slightly different than what you may be using to create a salt. Look in dolphin for the function that creates the salt - and try starting there.

The function that creates the salt it's at inc/utils and it's called genRndSalt(); that's the one that I'm using.

 

Quote · 18 Mar 2016

i think there is more to it than that - there was a post a while back in regards to how the salt works - I believe deano gave the OP the answer.

caredesign.net
Quote · 18 Mar 2016

 

i think there is more to it than that - there was a post a while back in regards to how the salt works - I believe deano gave the OP the answer.

 Thanks @, and where do I find deano? or the post you're referring to? been looking at the technical forum for a while now and can't find anything related to this.

Quote · 18 Mar 2016

I am not sure, but I think this should help you. https://www.boonex.com/forums/topic/Reset-Admin-Password.htm and maybe this https://www.boonex.com/forums/topic/Add-Member-Through-Admin-Panel.htm

caredesign.net
Quote · 18 Mar 2016

 

I am not sure, but I think this should help you. https://www.boonex.com/forums/topic/Reset-Admin-Password.htm and maybe this https://www.boonex.com/forums/topic/Add-Member-Through-Admin-Panel.htm

 Thanks again Professor, finally I disabled database cache in Admin Panel -> Tools -> Cache -> Settings and verified in the cache folder that there were some files for my users, example: user1.php and had the salt and password cached. Deleting this files and changing the configuration in the admin panel did what I expected.

 

Thanks for the help and for the responses.

Quote · 18 Mar 2016
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.