Implemented GUI aspect of usermanagement page
TODO: add ajax-call that will update database
This commit is contained in:
@ -76,7 +76,7 @@ function storeToken (string $secureToken, string $qualifiedUsername, string $htt
|
||||
catch (Exception $e) {
|
||||
return ['status' => 'Fail', 'reason' => $e];
|
||||
}
|
||||
|
||||
|
||||
// Save authentication token in cookie clientside
|
||||
$cookieDomain = array_values(array_filter($settings->Session['CookieDomains'], function ($value) use ($httpHost) {
|
||||
// Check if $_SERVER['HTTP_HOST'] matches any of the configured domains (either explicitly or as a subdomain)
|
||||
@ -114,9 +114,9 @@ function validateToken (string $secureToken) {
|
||||
|
||||
// Retrieve all authentication tokens from database matching username
|
||||
$pdoQuery = $pdoDB->prepare('
|
||||
SELECT SecureToken.Value
|
||||
SELECT User.Id, SecureToken.Value
|
||||
FROM SecureToken
|
||||
LEFT JOIN User
|
||||
LEFT JOIN User
|
||||
ON (User.Id=SecureToken.UserId)
|
||||
WHERE User.Username = :username
|
||||
');
|
||||
@ -126,6 +126,7 @@ function validateToken (string $secureToken) {
|
||||
foreach($pdoQuery->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
try {
|
||||
$storedTokens[] = JWT::decode($row['Value'], base64_decode($settings->JWT['PrivateKey_base64']), $settings->JWT['Algorithm']);
|
||||
$currentUserId = $row['Id'];
|
||||
} catch (Exception $e) {
|
||||
continue;
|
||||
}
|
||||
@ -137,7 +138,8 @@ function validateToken (string $secureToken) {
|
||||
})) === 1) {
|
||||
return [
|
||||
'status' => 'Success',
|
||||
'name' => $jwtPayload->name
|
||||
'name' => $jwtPayload->name,
|
||||
'uid' => $currentUserId
|
||||
];
|
||||
} else {
|
||||
if ($settings->Debug['LogToFile']) {
|
||||
|
Reference in New Issue
Block a user