Last active
March 28, 2017 13:35
-
-
Save CallumCarmicheal/c4b42d6d3b09c80305e2d9b5eccb3366 to your computer and use it in GitHub Desktop.
The few line error that almost killed the business i work for
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// What was in the source | |
// | |
// Old hashing method | |
if ($passwordType == 1) | |
if (!self::CheckPassword_Old($pass, $user)) | |
return self::$E_LOGIN_STATUS_INVALID_PASSWORD_1; | |
// New hashing method | |
else if ($passwordType == 2) | |
if (!password_verify($pass, $user->getPassword())) | |
return self::$E_LOGIN_STATUS_INVALID_PASSWORD_2; | |
// | |
// What actually happened | |
// | |
// Old hashing method | |
if ($passwordType == 1) { | |
if (!self::CheckPassword_Old($pass, $user)) | |
return self::$E_LOGIN_STATUS_INVALID_PASSWORD_1; | |
// New hashing method | |
else if ($passwordType == 2) | |
if (!password_verify($pass, $user->getPassword())) | |
return self::$E_LOGIN_STATUS_INVALID_PASSWORD_2; | |
} | |
// here is where we say the user logged in correctly, | |
// so if the user updated their password in the past 30+ days, they | |
// could be accessed by anyone :X | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment