various html and js fixes

Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
This commit is contained in:
Maurice Preuß (envoyr) 2023-11-11 21:29:02 +01:00
parent 3f1b792f60
commit 287ad84b18
No known key found for this signature in database
GPG Key ID: 5A16F49AF96F462F
14 changed files with 29 additions and 19 deletions

View File

@ -43,7 +43,8 @@ return [
'settinggroup' => 'spf',
'varname' => 'spf_entry',
'type' => 'text',
'default' => '"v=spf1 a mx -all"',
'string_regexp' => '/^v=spf[a-z0-9:~?\s\.-]+$/i',
'default' => 'v=spf1 a mx -all',
'save_method' => 'storeSettingField'
]
]

View File

@ -304,7 +304,7 @@ class Install
throw new Exception(lng('error.invalidip', [$serveripv4]));
} elseif (!empty($serveripv6) && (!Validate::validate_ip2($serveripv6, true, '', false, true) || IPTools::is_ipv6($serveripv6) == false)) {
throw new Exception(lng('error.invalidip', [$serveripv6]));
} elseif (!Validate::validateDomain($servername) && !Validate::validateLocalHostname($servername)) {
} elseif (!Validate::validateDomain($servername)) {
throw new Exception(lng('install.errors.servernameneedstobevalid'));
} elseif (posix_getpwnam($httpuser) === false) {
throw new Exception(lng('install.errors.websrvuserdoesnotexist'));

View File

@ -193,10 +193,14 @@ class Form
if (!$do_show) {
$fielddata['note'] = lng('serversettings.option_requires_otp');
if (!$otp_enabled_system) {
$fielddata['disabled'] = true;
$fielddata['note'] .= '<br>' . lng('2fa.2fa_not_activated');
} elseif (!$otp_enabled_user) {
$fielddata['disabled'] = true;
$fielddata['note'] .= '<br>' . lng('2fa.2fa_not_activated_for_user');
}
// show field in any case
$do_show = true;
}
}

View File

@ -114,10 +114,10 @@ if (!isset($sql) || !is_array($sql)) {
/**
* Show nice note if requested domain is "unknown" to froxlor and thus is being lead to its vhost
*/
if ($_SERVER['HTTP_HOST'] != Settings::Get('system.hostname') &&
!filter_var($_SERVER['HTTP_HOST'], FILTER_VALIDATE_IP) && (
if ($_SERVER['SERVER_NAME'] != Settings::Get('system.hostname') &&
!filter_var($_SERVER['SERVER_NAME'], FILTER_VALIDATE_IP) && (
empty(Settings::Get('system.froxloraliases')) ||
(!empty(Settings::Get('system.froxloraliases')) && !in_array($_SERVER['HTTP_HOST'], array_map('trim', explode(',', Settings::Get('system.froxloraliases')))))
(!empty(Settings::Get('system.froxloraliases')) && !in_array($_SERVER['SERVER_NAME'], array_map('trim', explode(',', Settings::Get('system.froxloraliases')))))
)) {
// not the froxlor system-hostname, show info page for domains not configured in froxlor
$unconfiguredPath = FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/templates/misc/unconfigured/index.html');
@ -346,6 +346,7 @@ if (CurrentUser::hasSession()) {
if (in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT', 'PATCH', 'DELETE'])) {
$current_token = $_POST['csrf_token'] ?? $_SERVER['HTTP_X_CSRF_TOKEN'] ?? null;
if ($current_token != CurrentUser::getField('csrf_token')) {
http_response_code(403);
Response::dynamicError('CSRF validation failed');
}
}

View File

@ -18,3 +18,4 @@ window.Chart = Chart;
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = document.querySelector('meta[name="csrf-token"]').getAttribute('content');

View File

@ -31,6 +31,9 @@ export default function () {
planid: pid
},
dataType: "json",
beforeSend: function(request) {
request.setRequestHeader('X-CSRF-TOKEN', document.querySelector('meta[name="csrf-token"]').getAttribute('content'));
},
success: function (json) {
for (var i in json) {
if (i == 'email_imap' || i == 'email_pop3' || i == 'perlenabled' || i == 'phpenabled' || i == 'dnsenabled' || i == 'logviewenabled') {

View File

@ -144,7 +144,7 @@
{% endmacro %}
{% macro plain(id, field) %}
<input type="text" readonly class="form-control-plaintext" id="{{ id }}" name="{{ id }}" value="{{ field.value|raw|e }}">
<input type="text" readonly class="form-control-plaintext" id="{{ id }}" name="{{ id }}" value="{{ field.value|raw }}">
{% if field.next_to is defined %}
{% for nid, nfield in field.next_to %}
{% if nfield.next_to_prefix is defined %}
@ -159,9 +159,9 @@
{% if field.next_to is defined %}
<div class="input-group">
{% endif %}
<input type="{{ field.type }}" {% if field.visible is defined and field.visible == false %} disabled {% endif %} {% if field.type == 'number' and field.min is defined %} min="{{ field.min }}" {% endif %} {% if field.type == 'number' and field.max is defined %} max="{{ field.max }}" {% endif %} {% if field.type != 'number' and field.maxlength is defined %} maxlength="{{ field.maxlength }}" {% endif %} id="{{ id }}" name="{{ id }}" value="{{ field.value|raw|e }}" class="form-control {% if field.valid is defined and field.valid == false %}is-invalid{% endif %}" {% if field.mandatory is defined and field.mandatory %} required {% endif %} {% if field.readonly is defined and field.readonly %} readonly {% endif %} {% if field.autocomplete is defined %} autocomplete="{{ field.autocomplete }}" {% endif %} {% if field.placeholder is defined %} placeholder="{{ field.placeholder }}" {% endif %} {% if field.type == 'file' and field.accept is defined %} accept="{{ field.accept }}" {% endif %} {% if field.pattern is defined %} pattern="{{ field.pattern }}" {% endif %}/>
<input type="{{ field.type }}" {% if field.visible is defined and field.visible == false %} disabled {% endif %} {% if field.type == 'number' and field.min is defined %} min="{{ field.min }}" {% endif %} {% if field.type == 'number' and field.max is defined %} max="{{ field.max }}" {% endif %} {% if field.type != 'number' and field.maxlength is defined %} maxlength="{{ field.maxlength }}" {% endif %} id="{{ id }}" name="{{ id }}" value="{{ field.value|raw }}" class="form-control {% if field.valid is defined and field.valid == false %}is-invalid{% endif %}" {% if field.mandatory is defined and field.mandatory %} required {% endif %} {% if field.readonly is defined and field.readonly %} readonly {% endif %} {% if field.autocomplete is defined %} autocomplete="{{ field.autocomplete }}" {% endif %} {% if field.placeholder is defined %} placeholder="{{ field.placeholder }}" {% endif %} {% if field.type == 'file' and field.accept is defined %} accept="{{ field.accept }}" {% endif %} {% if field.pattern is defined %} pattern="{{ field.pattern }}" {% endif %}/>
{% if field.type == 'hidden' and field.display is defined %}
<input type="text" readonly class="form-control-plaintext" value="{{ field.display|raw|e }}">
<input type="text" readonly class="form-control-plaintext" value="{{ field.display|raw }}">
{% endif %}
{% if field.next_to is defined %}
{% for nid, nfield in field.next_to %}

View File

@ -27,7 +27,7 @@
<div class="card-body d-grid gap-2">
<input type="hidden" name="action" value="2fa_verify"/>
<input type="hidden" name="send" value="send"/>
<button class="btn btn-primary rounded-top-0" type="submit" name="2faverify">{{ lng('2fa.2fa_verify') }}</button>
<button class="btn btn-primary" type="submit" name="2faverify">{{ lng('2fa.2fa_verify') }}</button>
</div>
</div>
</form>

View File

@ -38,7 +38,7 @@
</div>
<div class="card-body d-grid gap-2">
<button class="btn btn-primary rounded-top-0" type="submit" name="doremind">{{ lng('login.remind') }}</button>
<button class="btn btn-primary" type="submit" name="doremind">{{ lng('login.remind') }}</button>
</div>
<div class="card-footer">

View File

@ -39,7 +39,7 @@
</div>
<div class="card-body d-grid gap-2">
<button class="btn btn-primary rounded-top-0" type="submit" name="dologin">{{ lng('login.login') }}</button>
<button class="btn btn-primary" type="submit" name="dologin">{{ lng('login.login') }}</button>
</div>
{% if get_setting('panel.allow_preset') == '1' %}

View File

@ -30,7 +30,7 @@
</div>
<div class="card-body d-grid gap-2">
<button class="btn btn-primary rounded-top-0" type="submit" name="doremind">{{ lng('login.remind') }}</button>
<button class="btn btn-primary" type="submit" name="doremind">{{ lng('login.remind') }}</button>
</div>
<div class="card-footer">

View File

@ -45,13 +45,13 @@
<input type="hidden" name="page" value="{{ page }}"/>
<input type="hidden" name="send" value="send"/>
{% if userinfo.type_2fa == 0 %}
<button class="btn btn-primary rounded-top-0" type="submit" name="preadd">
<button class="btn btn-primary" type="submit" name="preadd">
{{ lng('2fa.2fa_add') }}</button>
{% elseif userinfo['2fa_unsaved'] is defined and userinfo['2fa_unsaved'] %}
<button class="btn btn-primary rounded-top-0" type="submit" name="add">
<button class="btn btn-primary" type="submit" name="add">
{{ lng('2fa.2fa_add') }}</button>
{% else %}
<button class="btn btn-warning rounded-top-0" type="submit" name="delete">
<button class="btn btn-warning" type="submit" name="delete">
{{ lng('2fa.2fa_delete') }}</button>
{% endif %}
</div>

View File

@ -64,7 +64,7 @@
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="hidden" name="page" value="{{ page }}"/>
<input type="hidden" name="send" value="changepassword"/>
<button class="btn btn-primary rounded-top-0" type="submit" name="dosave">
<button class="btn btn-primary" type="submit" name="dosave">
<i class="fa-regular fa-floppy-disk"></i>
{{ lng('menue.main.changepassword') }}</button>
</div>
@ -96,7 +96,7 @@
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="hidden" name="page" value="{{ page }}"/>
<input type="hidden" name="send" value="changetheme"/>
<button class="btn btn-primary rounded-top-0" type="submit" name="dosave">
<button class="btn btn-primary" type="submit" name="dosave">
<i class="fa-regular fa-floppy-disk"></i>
{{ lng('menue.main.changetheme') }}
</button>
@ -130,7 +130,7 @@
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="hidden" name="page" value="{{ page }}"/>
<input type="hidden" name="send" value="changelanguage"/>
<button class="btn btn-primary rounded-top-0" type="submit" name="dosave">
<button class="btn btn-primary" type="submit" name="dosave">
<i class="fa-regular fa-floppy-disk"></i>
{{ lng('menue.main.changelanguage') }}</button>
</div>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>froxlor - Deactivated page</title>
<title>froxlor - Domain not configured</title>
<style>
:root{--primary:#1872a2;--fonts:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}
body{display:flex;flex-direction:column;background:#f8f9fa;color:#4b5563;align-items:center;justify-content:center;font-family:var(--fonts)}