WHY WAS THIS DIFFERENT

This commit is contained in:
flash 2015-04-27 15:18:57 +00:00
parent 791871c580
commit 64b8845e73
3 changed files with 24 additions and 14 deletions

View file

@ -9,7 +9,8 @@
"builds": [ "builds": [
"20150427", "20150427",
"20150427.1" "20150427.1",
"20150427.2"
] ]
@ -702,6 +703,15 @@
"change": "Fixed /u/[username] not working." "change": "Fixed /u/[username] not working."
} }
],
"20150427.2": [
{
"type": "FIX",
"change": "Fixed bug caused by bug fix in login process (ironic)."
}
] ]
} }

View file

@ -102,25 +102,25 @@ class Users {
return [0, 'USER_NOT_EXIST']; return [0, 'USER_NOT_EXIST'];
// Get account data // Get account data
$userData = self::getUser($uid); $user = self::getUser($uid);
// Validate password // Validate password
if($userData['password_algo'] == 'nologin') { // Disable logging in to an account if($user['password_algo'] == 'nologin') { // Disable logging in to an account
return [0, 'NO_LOGIN']; return [0, 'NO_LOGIN'];
} elseif($userData['password_algo'] == 'legacy') { // Shitty legacy method of sha512(strrev(sha512())) } elseif($user['password_algo'] == 'legacy') { // Shitty legacy method of sha512(strrev(sha512()))
if(Main::legacyPasswordHash($password) != $userData['password_hash']) if(Main::legacyPasswordHash($password) != $user['password_hash'])
return [0, 'INCORRECT_PASSWORD']; return [0, 'INCORRECT_PASSWORD'];
} else { // PBKDF2 hashing } else { // PBKDF2 hashing
if(!Hashing::validate_password($password, [ if(!Hashing::validate_password($password, [
$userData['password_algo'], $user['password_algo'],
$userData['password_iter'], $user['password_iter'],
$userData['password_salt'], $user['password_salt'],
$userData['password_hash'] $user['password_hash']
])) ]))
return [0, 'INCORRECT_PASSWORD']; return [0, 'INCORRECT_PASSWORD'];
@ -131,14 +131,14 @@ class Users {
return [0, 'DEACTIVATED']; return [0, 'DEACTIVATED'];
// Create a new session // Create a new session
$sessionKey = Session::newSession($userData['id'], $remember); $sessionKey = Session::newSession($user['id'], $remember);
// Set cookies // Set cookies
setcookie(Configuration::getConfig('cookie_prefix') .'id', $userData['id'], time() + 604800, Configuration::getConfig('cookie_path'), Configuration::getConfig('cookie_domain')); setcookie(Configuration::getConfig('cookie_prefix') .'id', $user['id'], time() + 604800, Configuration::getConfig('cookie_path'), Configuration::getConfig('cookie_domain'));
setcookie(Configuration::getConfig('cookie_prefix') .'session', $sessionKey, time() + 604800, Configuration::getConfig('cookie_path'), Configuration::getConfig('cookie_domain')); setcookie(Configuration::getConfig('cookie_prefix') .'session', $sessionKey, time() + 604800, Configuration::getConfig('cookie_path'), Configuration::getConfig('cookie_domain'));
// Successful login! (also has a thing for the legacy password system) // Successful login! (also has a thing for the legacy password system)
return [1, ($userData['password_algo'] == 'legacy' ? 'LEGACY_SUCCESS' : 'LOGIN_SUCESS')]; return [1, ($user['password_algo'] == 'legacy' ? 'LEGACY_SUCCESS' : 'LOGIN_SUCESS')];
} }

View file

@ -8,7 +8,7 @@
namespace Sakura; namespace Sakura;
// Define Sakura version // Define Sakura version
define('SAKURA_VERSION', '20150427.1'); define('SAKURA_VERSION', '20150427.2');
define('SAKURA_VLABEL', 'Heliotrope'); define('SAKURA_VLABEL', 'Heliotrope');
define('SAKURA_VTYPE', 'Development'); define('SAKURA_VTYPE', 'Development');
define('SAKURA_COLOUR', '#DF73FF'); define('SAKURA_COLOUR', '#DF73FF');