Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug in login procedure #1139

Open
wants to merge 2 commits into
base: 18.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ public function __construct()
*/
public function updatePwdHashIfNeeded(string $sPassword, string $sUserPasswordHash, string $sEmail): void
{
if ($sNewPwdHash = Security::pwdNeedsRehash($sPassword, $sUserPasswordHash)) {
$this->oAdminModel->changePassword($sEmail, $sNewPwdHash, DbTableName::ADMIN);
if (Security::pwdNeedsRehash($sPassword, $sUserPasswordHash)) {
$this->oAdminModel->changePassword($sEmail, $sPassword, DbTableName::ADMIN);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ public function __construct()
*/
public function updatePwdHashIfNeeded(string $sPassword, string $sUserPasswordHash, string $sEmail): void
{
if ($sNewPwdHash = Security::pwdNeedsRehash($sPassword, $sUserPasswordHash)) {
$this->oAffModel->changePassword($sEmail, $sNewPwdHash, DbTableName::AFFILIATE);
if (Security::pwdNeedsRehash($sPassword, $sUserPasswordHash)) {
$this->oAffModel->changePassword($sEmail, $sPassword, DbTableName::AFFILIATE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ public function __construct()
*/
public function updatePwdHashIfNeeded(string $sPassword, string $sUserPasswordHash, string $sEmail): void
{
if ($sNewPwdHash = Security::pwdNeedsRehash($sPassword, $sUserPasswordHash)) {
$this->oUserModel->changePassword($sEmail, $sNewPwdHash, DbTableName::MEMBER);
if (Security::pwdNeedsRehash($sPassword, $sUserPasswordHash)) {
$this->oUserModel->changePassword($sEmail, $sPassword, DbTableName::MEMBER);
}
}

Expand Down
4 changes: 2 additions & 2 deletions _protected/framework/Security/Security.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ public static function checkPwd($sPassword, $sHash)
* @param string $sPassword
* @param string $sHash
*
* @return string|bool Returns the new password if the password needs to be rehash, otherwise FALSE
* @return bool Returns TRUE if the password needs to be rehash, otherwise FALSE
*/
public static function pwdNeedsRehash($sPassword, $sHash)
{
if (password_needs_rehash($sHash, self::PWD_ALGORITHM, self::$aPwdOptions)) {
return self::hashPwd($sPassword);
return true;
}

return false;
Expand Down