first non-install template (login); mostly testing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
17
index.php
17
index.php
@@ -22,6 +22,7 @@ require './lib/init.php';
|
|||||||
use Froxlor\Database\Database;
|
use Froxlor\Database\Database;
|
||||||
use Froxlor\Settings;
|
use Froxlor\Settings;
|
||||||
use Froxlor\FroxlorLogger;
|
use Froxlor\FroxlorLogger;
|
||||||
|
use Froxlor\UI\Panel\UI;
|
||||||
|
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
$action = 'login';
|
$action = 'login';
|
||||||
@@ -32,7 +33,7 @@ if (session_status() == PHP_SESSION_NONE) {
|
|||||||
ini_set("url_rewriter.tags", "");
|
ini_set("url_rewriter.tags", "");
|
||||||
ini_set("session.use_cookies", false);
|
ini_set("session.use_cookies", false);
|
||||||
ini_set("session.cookie_httponly", true);
|
ini_set("session.cookie_httponly", true);
|
||||||
ini_set("session.cookie_secure", $is_ssl);
|
ini_set("session.cookie_secure", UI::$SSL_REQ);
|
||||||
session_id('login');
|
session_id('login');
|
||||||
session_start();
|
session_start();
|
||||||
}
|
}
|
||||||
@@ -369,9 +370,9 @@ if ($action == '2fa_entercode') {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$update_in_progress = '';
|
$update_in_progress = false;
|
||||||
if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) {
|
if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) {
|
||||||
$update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin'];
|
$update_in_progress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass the last used page if needed
|
// Pass the last used page if needed
|
||||||
@@ -390,7 +391,15 @@ if ($action == '2fa_entercode') {
|
|||||||
$lastqrystr = htmlspecialchars($_REQUEST['qrystr'], ENT_QUOTES);
|
$lastqrystr = htmlspecialchars($_REQUEST['qrystr'], ENT_QUOTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('login') . "\";");
|
UI::TwigBuffer('login/login.html.twig', [
|
||||||
|
'pagetitle' => 'Login',
|
||||||
|
'lastscript' => $lastscript,
|
||||||
|
'lastqrystr' => $lastqrystr,
|
||||||
|
'upd_in_progress' => $update_in_progress,
|
||||||
|
'message' => $message,
|
||||||
|
'successmsg' => $successmessage
|
||||||
|
]);
|
||||||
|
UI::TwigOutputBuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ class UI
|
|||||||
|
|
||||||
private static $install_mode = false;
|
private static $install_mode = false;
|
||||||
|
|
||||||
|
public static $SSL_REQ = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send various security related headers
|
* send various security related headers
|
||||||
*/
|
*/
|
||||||
@@ -80,6 +82,7 @@ class UI
|
|||||||
* If Froxlor was called via HTTPS -> enforce it for the next time by settings HSTS header according to settings
|
* If Froxlor was called via HTTPS -> enforce it for the next time by settings HSTS header according to settings
|
||||||
*/
|
*/
|
||||||
if (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) {
|
if (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) {
|
||||||
|
self::$SSL_REQ = true;
|
||||||
$maxage = \Froxlor\Settings::Get('system.hsts_maxage');
|
$maxage = \Froxlor\Settings::Get('system.hsts_maxage');
|
||||||
if (empty($maxage)) {
|
if (empty($maxage)) {
|
||||||
$maxage = 0;
|
$maxage = 0;
|
||||||
|
|||||||
17
lib/init.php
17
lib/init.php
@@ -294,6 +294,8 @@ if ($language != 'English') {
|
|||||||
// last but not least include language references file
|
// last but not least include language references file
|
||||||
include_once \Froxlor\FileDir::makeSecurePath('lng/lng_references.php');
|
include_once \Froxlor\FileDir::makeSecurePath('lng/lng_references.php');
|
||||||
|
|
||||||
|
UI::setLng($lng);
|
||||||
|
|
||||||
// Initialize our new link - class
|
// Initialize our new link - class
|
||||||
$linker = new \Froxlor\UI\Linker('index.php', $s);
|
$linker = new \Froxlor\UI\Linker('index.php', $s);
|
||||||
|
|
||||||
@@ -317,15 +319,14 @@ if (preg_match("/([a-z0-9\.\-]+)_([a-z0-9\.\-]+)/i", $theme, $matches)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for existence of the theme
|
// check for existence of the theme
|
||||||
if (!file_exists('templates/' . $theme . '/config.json')) {
|
if (@file_exists('templates/' . $theme . '/config.json')) {
|
||||||
// Fallback
|
$_themeoptions = json_decode(file_get_contents('templates/' . $theme . '/config.json'), true);
|
||||||
$theme = $_deftheme;
|
} else {
|
||||||
|
$_themeoptions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_themeoptions = json_decode(file_get_contents('templates/' . $theme . '/config.json'), true);
|
|
||||||
|
|
||||||
// check for existence of variant in theme
|
// check for existence of variant in theme
|
||||||
if (!array_key_exists('variants', $_themeoptions) || !array_key_exists($themevariant, $_themeoptions['variants'])) {
|
if (is_array($_themeoptions) && (!array_key_exists('variants', $_themeoptions) || !array_key_exists($themevariant, $_themeoptions['variants']))) {
|
||||||
$themevariant = "default";
|
$themevariant = "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,7 +426,7 @@ if (AREA == 'admin' || AREA == 'customer') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$js = "";
|
$js = "";
|
||||||
if (array_key_exists('js', $_themeoptions['variants'][$themevariant]) && is_array($_themeoptions['variants'][$themevariant]['js'])) {
|
if (is_array($_themeoptions) && array_key_exists('js', $_themeoptions['variants'][$themevariant]) && is_array($_themeoptions['variants'][$themevariant]['js'])) {
|
||||||
foreach ($_themeoptions['variants'][$themevariant]['js'] as $jsfile) {
|
foreach ($_themeoptions['variants'][$themevariant]['js'] as $jsfile) {
|
||||||
if (file_exists('templates/' . $theme . '/assets/js/' . $jsfile)) {
|
if (file_exists('templates/' . $theme . '/assets/js/' . $jsfile)) {
|
||||||
$js .= '<script type="text/javascript" src="templates/' . $theme . '/assets/js/' . $jsfile . '"></script>' . "\n";
|
$js .= '<script type="text/javascript" src="templates/' . $theme . '/assets/js/' . $jsfile . '"></script>' . "\n";
|
||||||
@@ -434,7 +435,7 @@ if (array_key_exists('js', $_themeoptions['variants'][$themevariant]) && is_arra
|
|||||||
}
|
}
|
||||||
|
|
||||||
$css = "";
|
$css = "";
|
||||||
if (array_key_exists('css', $_themeoptions['variants'][$themevariant]) && is_array($_themeoptions['variants'][$themevariant]['css'])) {
|
if (is_array($_themeoptions) && array_key_exists('css', $_themeoptions['variants'][$themevariant]) && is_array($_themeoptions['variants'][$themevariant]['css'])) {
|
||||||
foreach ($_themeoptions['variants'][$themevariant]['css'] as $cssfile) {
|
foreach ($_themeoptions['variants'][$themevariant]['css'] as $cssfile) {
|
||||||
if (file_exists('templates/' . $theme . '/assets/css/' . $cssfile)) {
|
if (file_exists('templates/' . $theme . '/assets/css/' . $cssfile)) {
|
||||||
$css .= '<link href="templates/' . $theme . '/assets/css/' . $cssfile . '" rel="stylesheet" type="text/css" />' . "\n";
|
$css .= '<link href="templates/' . $theme . '/assets/css/' . $cssfile . '" rel="stylesheet" type="text/css" />' . "\n";
|
||||||
|
|||||||
28
templates/Froxlor/config.json
Normal file
28
templates/Froxlor/config.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"default": {
|
||||||
|
"css": [
|
||||||
|
"main.css",
|
||||||
|
"custom.css"
|
||||||
|
],
|
||||||
|
"js": [
|
||||||
|
"main.js",
|
||||||
|
"apikey.js"
|
||||||
|
],
|
||||||
|
"description": "Default"
|
||||||
|
},
|
||||||
|
"dark": {
|
||||||
|
"css": [
|
||||||
|
"main.css",
|
||||||
|
"dark.css",
|
||||||
|
"custom.css"
|
||||||
|
],
|
||||||
|
"js": [
|
||||||
|
"main.js",
|
||||||
|
"apikey.js"
|
||||||
|
],
|
||||||
|
"description": "Darkmode"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"author": "Froxlor"
|
||||||
|
}
|
||||||
47
templates/Froxlor/login/login.html.twig
Normal file
47
templates/Froxlor/login/login.html.twig
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
{% extends "Froxlor/base.html.twig" %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="container p-3 bg-light border border-top-0">
|
||||||
|
<img src="{{ basehref|default('') }}templates/Froxlor/assets/img/logo.png" alt="Froxlor Server Management Panel"/>
|
||||||
|
<section class="mt-4">
|
||||||
|
<h3 class="text-center mb-3">{{ pagetitle }}</h3>
|
||||||
|
{% if upd_in_progress %}
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
{{ lng('update.updateinprogress_onlyadmincanlogin')|raw }}
|
||||||
|
</div>
|
||||||
|
{% elseif successmsg is not empty %}
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
<h4 class="alert-heading">{{ lng('success.success') }}</h4>
|
||||||
|
<p>{{ successmsg|raw }}</p>
|
||||||
|
</div>
|
||||||
|
{% elseif message is not empty %}
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
<h4 class="alert-heading">{{ lng('error.error') }}</h4>
|
||||||
|
<p>{{ message|raw }}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<form action="index.php" method="post" enctype="application/x-www-form-urlencoded">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="loginname" class="col-sm-4 col-form-label">{{ lng('login.username') }}</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="loginname" id="loginname" value="" required/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="password" class="col-sm-4 col-form-label">{{ lng('login.password') }}</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="password" name="password" id="password" value="" required/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<strong>language stuff noch</strong>
|
||||||
|
<aside class="text-end">
|
||||||
|
<input type="hidden" name="script" value="{{ lastscript }}" />
|
||||||
|
<input type="hidden" name="qrystr" value="{{ lastqrystr }}" />
|
||||||
|
<input type="hidden" name="send" value="send" />
|
||||||
|
<button class="btn btn-sm btn-primary" type="submit" name="dologin">{{ lng('login.login') }}</button>
|
||||||
|
</aside>
|
||||||
|
</form>
|
||||||
|
<strong>passwort vergessen stuff noch</strong>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user