Compare commits

..

2 Commits

Author SHA1 Message Date
BitHeaven cbd55cec2d Remove password hash from return data 2024-08-09 22:32:02 +05:00
BitHeaven 913db80c30 Fix auth in User class 2024-08-09 22:31:15 +05:00
2 changed files with 9 additions and 3 deletions

View File

@ -74,11 +74,11 @@
return false; return false;
$until = time() + self::$tokenLifetime; $until = time() + self::$tokenLifetime;
$hash = hash('sha256', $login.'|'.$password.'|'.$until.'|'.self::$secret); $hash = hash('sha256', $login.'|'.$user->password.'|'.$until.'|'.self::$secret);
self::updateOnline($login); self::updateOnline($login);
return implode('|', rtrim(strtr(base64_encode($login.'|'.$password.'|'.$until.'|'.$hash), '+/', '-_'), '=')); return rtrim(strtr(base64_encode($login.'|'.$user->password.'|'.$until.'|'.$hash), '+/', '-_'), '=');
} }
public static function get($login) { public static function get($login) {

View File

@ -15,7 +15,13 @@
else { else {
$data = [ $data = [
'error' => false, 'error' => false,
'data' => $user, 'data' => [
'id' => $user->id,
'login' => $user->login,
'info' => $user->info,
'reg_dt' => $user->reg_dt,
'online_dt' => $user->online_dt,
],
]; ];
} }
} }