Migrated IDE platform; accepting nonexisting diffs to make IDE happy
This commit is contained in:
parent
1ffa164160
commit
c8fe81d222
@ -135,10 +135,13 @@ function validateToken (string $secureToken) {
|
||||
if (!empty($storedTokens) && sizeof(array_filter($storedTokens, function ($value) use ($jwtPayload) {
|
||||
return $value->iat === $jwtPayload->iat;
|
||||
})) === 1) {
|
||||
return ['status' => 'Success'];
|
||||
return [
|
||||
'status' => 'Success',
|
||||
'name' => $jwtPayload->name
|
||||
];
|
||||
} else {
|
||||
if ($settings->Debug['LogToFile']) {
|
||||
file_put_contents('../validateToken.log', (new DateTime())->format('Y-m-d\TH:i:s.u') . ' --- No matching token in database' . PHP_EOL, FILE_APPEND);
|
||||
file_put_contents('../validateToken.log', (new DateTime())->format('Y-m-d\TH:i:s.u') . ' --- Either no matching token or multiple matching tokens found in database' . PHP_EOL, FILE_APPEND);
|
||||
}
|
||||
return ['status' => 'Fail', 'reason' => '2'];
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ $pageLayout['full'] = <<<'FULL'
|
||||
<meta charset="utf-8" />
|
||||
<title>lucidAuth</title>
|
||||
<meta name="application-name" content="lucidAuth" />
|
||||
<meta name="theme-color" content="#B50000" />
|
||||
<meta name="theme-color" content="#003399" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
@ -52,7 +52,7 @@ $pageLayout['bare'] = <<<'BARE'
|
||||
</html>
|
||||
BARE;
|
||||
|
||||
$contentLayout['login'] = <<<LOGIN
|
||||
$contentLayout['login'] = <<<'LOGIN'
|
||||
<script src="misc/script.index.js"></script>
|
||||
<fieldset>
|
||||
<legend>Login Details</legend>
|
||||
@ -67,7 +67,7 @@ $contentLayout['login'] = <<<LOGIN
|
||||
<input type="password" id="password" name="password" tabindex="200" />
|
||||
</li>
|
||||
<li>
|
||||
<input type="hidden" id="ref" name="ref" value="{$_GET['ref']}" />
|
||||
<input type="hidden" id="ref" name="ref" value="%1$s" />
|
||||
<button id="btnlogin" class="bttn-simple bttn-xs bttn-primary" tabindex="300" data-translation="button_login">login</button>
|
||||
</li>
|
||||
<li class="misc">
|
||||
@ -83,9 +83,9 @@ LOGIN;
|
||||
|
||||
$contentLayout['manage'] = <<<'MANAGE'
|
||||
<script src="misc/script.manage.js"></script>
|
||||
<span id="user"><span data-translation="span_loggedinas">Ingelogd als</span> {$_SESSION['fullname']} --- [<a id="linkplugindialog" tabindex="600" data-translation="link_plugin">Browser plugin</a><div id="pluginlogos"><span data-translation="label_selectbrowser" style="float: left; margin-left: 5px;">Select browser:</span><span style="font-size: 8px; float: right; margin-right: 5px; margin-top: 2px;">[v0.2.122.4]</span><br /><img id="linkpluginchrome" src="images/chrome_256x256.png" /><img id="linkpluginfirefox" src="images/firefox_256x256.png" /><img id="linkpluginopera" src="images/opera_256x256.png" /></div>] [<a id="linklanguage-en" href="#" tabindex="700">EN</a> <a id="linklanguage-nl" class="current" href="#" tabindex="700">NL</a>] [<a href="index.php?do=logout" tabindex="800" data-translation="link_logout">Log uit</a>]</span>
|
||||
<!-- <fieldset style="clear: both;">
|
||||
<legend>Beheer Account</legend>
|
||||
<span id="user"><span data-translation="span_loggedinas">Ingelogd als</span> %1$s --- [<a id="linklanguage-en" href="#" tabindex="700">EN</a> <a id="linklanguage-nl" class="current" href="#" tabindex="700">NL</a>] [<a href="#" tabindex="800" data-translation="link_logout">Log uit</a>]</span>
|
||||
<fieldset style="clear: both;">
|
||||
<legend>Beheer Gebruikers</legend>
|
||||
<ul>
|
||||
<li>
|
||||
</li>
|
||||
@ -105,18 +105,6 @@ $contentLayout['manage'] = <<<'MANAGE'
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
-->
|
||||
MANAGE;
|
||||
|
||||
$contentLayout['dialog'] = <<<DIALOG
|
||||
<ul class="dialog">
|
||||
<li>
|
||||
<!--REPL_DIALOGDESC-->
|
||||
</li>
|
||||
<li>
|
||||
<button id="btnhome" class="bttn-simple bttn-xs bttn-primary" tabindex="400" data-translation="button_home">ga naar startpagina</button>
|
||||
</li>
|
||||
</ul>
|
||||
DIALOG;
|
||||
|
||||
?>
|
27
public/example.php
Normal file
27
public/example.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
// Basic example of PHP script to handle with jQuery-Tabledit plug-in.
|
||||
// Note that is just an example. Should take precautions such as filtering the input data.
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$input = filter_input_array(INPUT_POST);
|
||||
|
||||
$mysqli = new mysqli('localhost', 'user', 'password', 'database');
|
||||
|
||||
if (mysqli_connect_errno()) {
|
||||
echo json_encode(array('mysqli' => 'Failed to connect to MySQL: ' . mysqli_connect_error()));
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($input['action'] === 'edit') {
|
||||
$mysqli->query("UPDATE users SET username='" . $input['username'] . "', email='" . $input['email'] . "', avatar='" . $input['avatar'] . "' WHERE id='" . $input['id'] . "'");
|
||||
} else if ($input['action'] === 'delete') {
|
||||
$mysqli->query("UPDATE users SET deleted=1 WHERE id='" . $input['id'] . "'");
|
||||
} else if ($input['action'] === 'restore') {
|
||||
$mysqli->query("UPDATE users SET deleted=0 WHERE id='" . $input['id'] . "'");
|
||||
}
|
||||
|
||||
mysqli_close($mysqli);
|
||||
|
||||
echo json_encode($input);
|
@ -8,8 +8,13 @@
|
||||
if ($result['status'] === 'Success') {
|
||||
// Store authentication token; in database serverside & in cookie clientside
|
||||
if (storeToken($result['token'], $settings->LDAP['Domain'] . '\\' . $_POST['username'], $_SERVER['HTTP_HOST'])['status'] !== 'Success') {
|
||||
// Since this action is only ever called through an AJAX-request; return JSON object
|
||||
echo '{"Result":"Fail","Reason":"Failed storing authentication token in database and/or cookie"}' . PHP_EOL;
|
||||
// Return JSON object
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode([
|
||||
"Result" => "Failure",
|
||||
"Reason" => "Failed storing authentication token in database and/or cookie"
|
||||
]);
|
||||
# echo '{"Result":"Fail","Reason":"Failed storing authentication token in database and/or cookie"}' . PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -19,13 +24,18 @@
|
||||
$proxyHeaders = json_decode(base64_decode($_POST['ref']), JSON_OBJECT_AS_ARRAY);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// Since this action is only ever called through an AJAX-request; return JSON object
|
||||
echo '{"Result":"Fail","Reason":"Original request URI lost in transition"}' . PHP_EOL;
|
||||
// Return JSON object
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode([
|
||||
"Result" => "Failure",
|
||||
"Reason" => "Original request-URI lost in transition"
|
||||
]);
|
||||
# echo '{"Result":"Fail","Reason":"Original request URI lost in transition"}' . PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
$originalUri = !empty($proxyHeaders) ? $proxyHeaders['XForwardedProto'] . '://' . $proxyHeaders['XForwardedHost'] . $proxyHeaders['XForwardedUri'] : 'lucidAuth.manage.php';
|
||||
|
||||
// Since this request is only ever called through an AJAX-request; return JSON object
|
||||
// Return JSON object
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode([
|
||||
"Result" => "Success",
|
||||
@ -40,7 +50,6 @@
|
||||
"Result" => "Failure",
|
||||
"Reason" => "Invalid username and/or password"
|
||||
]);
|
||||
# echo '{"Result":"Fail","Reason":"Invalid username and/or password"}' . PHP_EOL;
|
||||
break;
|
||||
default:
|
||||
header('Content-Type: application/json');
|
||||
@ -48,14 +57,17 @@
|
||||
"Result" => "Failure",
|
||||
"Reason" => "Uncaught error"
|
||||
]);
|
||||
# echo '{"Result":"Fail","Reason":"Uncaught error"}' . PHP_EOL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
include_once('../include/lucidAuth.template.php');
|
||||
|
||||
echo sprintf($pageLayout['full'], $contentLayout['login']);
|
||||
echo sprintf($pageLayout['full'],
|
||||
sprintf($contentLayout['login'],
|
||||
$_GET['ref']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
@ -3,10 +3,18 @@
|
||||
|
||||
include_once('../include/lucidAuth.functions.php');
|
||||
|
||||
if (!empty($_COOKIE['JWT']) && validateToken($_COOKIE['JWT'])['status'] === "Success") {
|
||||
if (!empty($_COOKIE['JWT'])) {
|
||||
$validateTokenResult = validateToken($_COOKIE['JWT']);
|
||||
}
|
||||
|
||||
if ($validateTokenResult['status'] === "Success") {
|
||||
include_once('../include/lucidAuth.template.php');
|
||||
|
||||
echo sprintf($pageLayout['full'], $contentLayout['manage']);
|
||||
echo sprintf($pageLayout['full'],
|
||||
sprintf($contentLayout['manage'],
|
||||
$validateTokenResult['name']
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// No cookie containing valid authentication token found;
|
||||
// explicitly deleting any remaining cookie, then redirecting to loginpage
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
include_once('../include/lucidAuth.template.php');
|
||||
|
||||
echo sprintf($pageLayout['bare',
|
||||
echo sprintf($pageLayout['bare'],
|
||||
'// iFrames go here'
|
||||
);
|
||||
?>
|
6
public/misc/script.table.min.js
vendored
Normal file
6
public/misc/script.table.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -8,13 +8,9 @@ var locales = {
|
||||
heading_error: "ERROR!",
|
||||
label_password: "Password:",
|
||||
label_username: "Username:",
|
||||
label_selectbrowser: "Select browser:",
|
||||
link_install: "Install!",
|
||||
link_logout: "Logout",
|
||||
link_plugin: "Browser plugin",
|
||||
span_credentialsavailable: "Login credentials available upon request!",
|
||||
span_loggedinas: "Logged in as",
|
||||
span_plugin: "Browser plugin?"
|
||||
span_loggedinas: "Logged in as"
|
||||
},
|
||||
nl: {
|
||||
button_add: "voeg toe",
|
||||
@ -25,13 +21,9 @@ var locales = {
|
||||
heading_error: "FOUT!",
|
||||
label_password: "Wachtwoord:",
|
||||
label_username: "Gebruikersnaam:",
|
||||
label_selectbrowser: "Selecteer browser:",
|
||||
link_install: "Installeer!",
|
||||
link_logout: "Log uit",
|
||||
link_plugin: "Browser plugin",
|
||||
span_credentialsavailable: "Inloggegevens verkrijgbaar op aanvraag!",
|
||||
span_loggedinas: "Ingelogd als",
|
||||
span_plugin: "Browser plugin?"
|
||||
span_loggedinas: "Ingelogd als"
|
||||
} // ... etc.
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user