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.