diff --git a/include/lucidAuth.functions.php b/include/lucidAuth.functions.php
index cc56ef6..df2aab2 100644
--- a/include/lucidAuth.functions.php
+++ b/include/lucidAuth.functions.php
@@ -66,17 +66,17 @@ function storeToken (string $secureToken, string $qualifiedUsername, string $htt
INSERT INTO SecureToken (UserId, Value)
SELECT User.Id, :securetoken
FROM User
- WHERE User.Username = :qualifiedusername
+ WHERE LOWER(User.Username) = :qualifiedusername
');
$pdoQuery->execute([
':securetoken' => $secureToken,
- ':qualifiedusername' => $qualifiedUsername
+ ':qualifiedusername' => strtolower($qualifiedUsername)
]);
}
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,18 +114,19 @@ 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
+ WHERE LOWER(User.Username) = :username
');
$pdoQuery->execute([
- ':username' => (string)$jwtPayload->sub
+ ':username' => (string) strtolower($jwtPayload->sub)
]);
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']) {
diff --git a/include/lucidAuth.template.php b/include/lucidAuth.template.php
index af0bc27..e1b45b6 100644
--- a/include/lucidAuth.template.php
+++ b/include/lucidAuth.template.php
@@ -10,14 +10,10 @@ $pageLayout['full'] = <<<'FULL'
lucidAuth
-
-
-
-
-
+
@@ -36,6 +32,46 @@ $pageLayout['full'] = <<<'FULL'
FULL;
+$pageLayout['full_alt'] = <<<'FULL_ALT'
+
+
+
+
+ lucidAuth
+
+
+
+
+
+
+
+
+
+
+
+
+
+FULL_ALT;
+
$pageLayout['bare'] = <<<'BARE'
@@ -43,7 +79,7 @@ $pageLayout['bare'] = <<<'BARE'
lucidAuth
-
+
@@ -54,16 +90,18 @@ BARE;
$contentLayout['login'] = <<<'LOGIN'
-
+
LOGIN;
-$contentLayout['manage'] = <<<'MANAGE'
+$contentLayout['manage']['header'] = <<<'MANAGE_HEADER'
- Ingelogd als %1$s --- [EN NL] [Log uit]
-