combine change-password, change-theme and change-language into 'my profile'

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2023-06-07 16:18:05 +02:00
parent bfc816a51e
commit 3445472049
9 changed files with 337 additions and 336 deletions

View File

@@ -31,6 +31,7 @@ use Froxlor\Api\Commands\Froxlor as Froxlor;
use Froxlor\CurrentUser; use Froxlor\CurrentUser;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger; use Froxlor\FroxlorLogger;
use Froxlor\Language;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\System\Cronjob; use Froxlor\System\Cronjob;
use Froxlor\System\Crypt; use Froxlor\System\Crypt;
@@ -38,7 +39,6 @@ use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request; use Froxlor\UI\Request;
use Froxlor\UI\Response; use Froxlor\UI\Response;
use Froxlor\Validate\Validate; use Froxlor\Validate\Validate;
use Froxlor\Language;
$id = (int)Request::any('id'); $id = (int)Request::any('id');
@@ -196,8 +196,11 @@ if ($page == 'overview') {
'outstanding_tasks' => $outstanding_tasks, 'outstanding_tasks' => $outstanding_tasks,
'cron_last_runs' => $cron_last_runs 'cron_last_runs' => $cron_last_runs
]); ]);
} elseif ($page == 'change_password') { } elseif ($page == 'profile') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { $languages = Language::getLanguages();
if (!empty($_POST)) {
if ($_POST['send'] == 'changepassword') {
$old_password = Validate::validate($_POST['old_password'], 'old password'); $old_password = Validate::validate($_POST['old_password'], 'old password');
if (!Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) { if (!Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) {
@@ -240,12 +243,22 @@ if ($page == 'overview') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'changed password'); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'changed password');
Response::redirectTo($filename); Response::redirectTo($filename);
} }
} else { } elseif ($_POST['send'] == 'changetheme') {
UI::view('user/change_password.html.twig'); if (Settings::Get('panel.allow_theme_change_admin') == 1) {
$theme = Validate::validate($_POST['theme'], 'theme');
try {
Admins::getLocal($userinfo, [
'id' => $userinfo['adminid'],
'theme' => $theme
])->update();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
} }
} elseif ($page == 'change_language') {
$languages = Language::getLanguages(); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
if (isset($_POST['send']) && $_POST['send'] == 'send') { }
Response::redirectTo($filename);
} elseif ($_POST['send'] == 'changelanguage') {
$def_language = Validate::validate($_POST['def_language'], 'default language'); $def_language = Validate::validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) { if (isset($languages[$def_language])) {
@@ -261,42 +274,26 @@ if ($page == 'overview') {
} }
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
Response::redirectTo($filename); Response::redirectTo($filename);
}
} else { } else {
// change theme
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
}
$themes_avail = UI::getThemes();
// change language
$default_lang = Settings::Get('panel.standardlanguage'); $default_lang = Settings::Get('panel.standardlanguage');
if ($userinfo['def_language'] != '') { if ($userinfo['def_language'] != '') {
$default_lang = $userinfo['def_language']; $default_lang = $userinfo['def_language'];
} }
UI::view('user/change_language.html.twig', [ UI::view('user/profile.html.twig', [
'languages' => $languages,
'default_lang' => $default_lang
]);
}
} elseif ($page == 'change_theme') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$theme = Validate::validate($_POST['theme'], 'theme');
try {
Admins::getLocal($userinfo, [
'id' => $userinfo['adminid'],
'theme' => $theme
])->update();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
Response::redirectTo($filename);
} else {
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
}
$themes_avail = UI::getThemes();
UI::view('user/change_theme.html.twig', [
'themes' => $themes_avail, 'themes' => $themes_avail,
'default_theme' => $default_theme 'default_theme' => $default_theme,
'languages' => $languages,
'default_lang' => $default_lang,
]); ]);
} }
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_admin') == '1') { } elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_admin') == '1') {

View File

@@ -27,18 +27,18 @@ const AREA = 'customer';
require __DIR__ . '/lib/init.php'; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\Customers as Customers; use Froxlor\Api\Commands\Customers as Customers;
use Froxlor\Cron\TaskId;
use Froxlor\CurrentUser; use Froxlor\CurrentUser;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\Froxlor; use Froxlor\Froxlor;
use Froxlor\FroxlorLogger; use Froxlor\FroxlorLogger;
use Froxlor\Language;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\System\Cronjob;
use Froxlor\System\Crypt; use Froxlor\System\Crypt;
use Froxlor\UI\Panel\UI; use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response; use Froxlor\UI\Response;
use Froxlor\Validate\Validate; use Froxlor\Validate\Validate;
use Froxlor\Language;
use Froxlor\System\Cronjob;
use Froxlor\Cron\TaskId;
if ($action == 'logout') { if ($action == 'logout') {
$log->logAction(FroxlorLogger::USR_ACTION, LOG_INFO, 'logged out'); $log->logAction(FroxlorLogger::USR_ACTION, LOG_INFO, 'logged out');
@@ -130,8 +130,11 @@ if ($page == 'overview') {
'domains' => $domainArray, 'domains' => $domainArray,
'stdsubdomain' => $stdsubdomain 'stdsubdomain' => $stdsubdomain
]); ]);
} elseif ($page == 'change_password') { } elseif ($page == 'profile') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { $languages = Language::getLanguages();
if (!empty($_POST)) {
if ($_POST['send'] == 'changepassword') {
$old_password = Validate::validate($_POST['old_password'], 'old password'); $old_password = Validate::validate($_POST['old_password'], 'old password');
if (!Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_CUSTOMERS, 'customerid')) { if (!Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_CUSTOMERS, 'customerid')) {
@@ -209,12 +212,22 @@ if ($page == 'overview') {
Response::redirectTo($filename); Response::redirectTo($filename);
} }
} else { } elseif ($_POST['send'] == 'changetheme') {
UI::view('user/change_password.html.twig'); if (Settings::Get('panel.allow_theme_change_customer') == 1) {
$theme = Validate::validate($_POST['theme'], 'theme');
try {
Customers::getLocal($userinfo, [
'id' => $userinfo['customerid'],
'theme' => $theme
])->update();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
} }
} elseif ($page == 'change_language') {
$languages = Language::getLanguages(); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
if (isset($_POST['send']) && $_POST['send'] == 'send') { }
Response::redirectTo($filename);
} elseif ($_POST['send'] == 'changelanguage') {
$def_language = Validate::validate($_POST['def_language'], 'default language'); $def_language = Validate::validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) { if (isset($languages[$def_language])) {
try { try {
@@ -229,42 +242,26 @@ if ($page == 'overview') {
} }
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
Response::redirectTo($filename); Response::redirectTo($filename);
}
} else { } else {
// change theme
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
}
$themes_avail = UI::getThemes();
// change language
$default_lang = Settings::Get('panel.standardlanguage'); $default_lang = Settings::Get('panel.standardlanguage');
if ($userinfo['def_language'] != '') { if ($userinfo['def_language'] != '') {
$default_lang = $userinfo['def_language']; $default_lang = $userinfo['def_language'];
} }
UI::view('user/change_language.html.twig', [ UI::view('user/profile.html.twig', [
'languages' => $languages,
'default_lang' => $default_lang
]);
}
} elseif ($page == 'change_theme') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$theme = Validate::validate($_POST['theme'], 'theme');
try {
Customers::getLocal($userinfo, [
'id' => $userinfo['customerid'],
'theme' => $theme
])->update();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
Response::redirectTo($filename);
} else {
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
}
$themes_avail = UI::getThemes();
UI::view('user/change_theme.html.twig', [
'themes' => $themes_avail, 'themes' => $themes_avail,
'default_theme' => $default_theme 'default_theme' => $default_theme,
'languages' => $languages,
'default_lang' => $default_lang,
]); ]);
} }
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') { } elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {

View File

@@ -1236,6 +1236,7 @@ Vielen Dank, Ihr Administrator',
'description' => 'Wähle das zu durchsuchende Feld aus' 'description' => 'Wähle das zu durchsuchende Feld aus'
], ],
'upload_import' => 'Hochladen und importieren', 'upload_import' => 'Hochladen und importieren',
'profile' => 'Mein Profil',
], ],
'phpfpm' => [ 'phpfpm' => [
'vhost_httpuser' => 'Lokaler Benutzer für PHP-FPM (Froxlor-Vhost)', 'vhost_httpuser' => 'Lokaler Benutzer für PHP-FPM (Froxlor-Vhost)',

View File

@@ -1351,6 +1351,7 @@ Yours sincerely, your administrator',
'description' => 'Select the field you want to search in' 'description' => 'Select the field you want to search in'
], ],
'upload_import' => 'Upload and import', 'upload_import' => 'Upload and import',
'profile' => 'My profile',
], ],
'phpfpm' => [ 'phpfpm' => [
'vhost_httpuser' => 'Local user to use for PHP-FPM (Froxlor vHost)', 'vhost_httpuser' => 'Local user to use for PHP-FPM (Froxlor vHost)',

View File

@@ -1,34 +0,0 @@
{% extends "Froxlor/userarea.html.twig" %}
{% block content %}
<div class="container">
<div class="row justify-content-center">
<form action="{{ linker({'section':'index'}) }}" class="col-12 max-w-420 d-flex flex-column" method="post" enctype="application/x-www-form-urlencoded">
<div class="card shadow">
<div class="card-body">
<h5 class="card-title">{{ lng('menue.main.changelanguage') }}</h5>
<div>
<label for="def_language" class="col-form-label">{{ lng('login.language') }}</label>
<select class="form-select" name="def_language" id="def_language" required>
<option value="profile">{{ lng('login.profile_lng') }}</option>
{% for val,lang in languages %}
<option value="{{ val }}" {% if default_lang == val %} selected="selected" {% endif %}>{{ lang|raw }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="card-body d-grid gap-2">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="hidden" name="page" value="{{ page }}"/>
<input type="hidden" name="send" value="send"/>
<button class="btn btn-primary rounded-top-0" type="submit" name="dosave">
<i class="fa-regular fa-floppy-disk"></i>
{{ lng('menue.main.changelanguage') }}</button>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View File

@@ -1,57 +0,0 @@
{% extends "Froxlor/userarea.html.twig" %}
{% block content %}
<div class="container">
<div class="row justify-content-center">
<form action="{{ linker({'section':'index'}) }}" class="col-12 max-w-420 d-flex flex-column" method="post" enctype="application/x-www-form-urlencoded">
<div class="card shadow">
<div class="card-body">
<h5 class="card-title">{{ lng('menue.main.changepassword') }}</h5>
<div class="mb-3">
<label for="old_password" class="col-form-label">{{ lng('changepassword.old_password') }}</label>
<input class="form-control" type="password" name="old_password" id="old_password" value="" required/>
</div>
<div class="mb-3">
<label for="new_password" class="col-form-label">{{ lng('changepassword.new_password') }}</label>
<input class="form-control" type="password" name="new_password" id="new_password" value="" required/>
</div>
<div class="mb-3">
<label for="new_password_confirm" class="col-form-label">{{ lng('changepassword.new_password_confirm') }}</label>
<input class="form-control" type="password" name="new_password_confirm" id="new_password_confirm" value="" required/>
</div>
{% if userinfo.adminsession == 0 %}
<div class="mb-3">
<label for="change_main_ftp" class="col-form-label">{{ lng('changepassword.also_change_ftp') }}</label>
<div class="form-check form-switch">
<input type="hidden" name="change_main_ftp" value="false">
<input class="form-check-input" type="checkbox" name="change_main_ftp" id="change_main_ftp" value="true" checked>
</div>
</div>
<div class="mb-3">
<label for="change_stats" class="col-form-label">{{ lng('changepassword.also_change_stats') }}</label>
<div class="form-check form-switch">
<input type="hidden" name="change_stats" value="false">
<input class="form-check-input" type="checkbox" name="change_stats" id="change_stats" value="true" checked>
</div>
</div>
{% endif %}
</div>
<div class="card-body d-grid gap-2">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="hidden" name="page" value="{{ page }}"/>
<input type="hidden" name="send" value="send"/>
<button class="btn btn-primary rounded-top-0" type="submit" name="dosave">
<i class="fa-regular fa-floppy-disk"></i>
{{ lng('menue.main.changepassword') }}</button>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View File

@@ -1,34 +0,0 @@
{% extends "Froxlor/userarea.html.twig" %}
{% block content %}
<div class="container">
<div class="row justify-content-center">
<form action="{{ linker({'section':'index'}) }}" class="col-12 max-w-420 d-flex flex-column" method="post" enctype="application/x-www-form-urlencoded">
<div class="card shadow">
<div class="card-body">
<h5 class="card-title">{{ lng('menue.main.changetheme') }}</h5>
<div>
<label for="theme" class="col-form-label">{{ lng('panel.theme') }}</label>
<select class="form-select" name="theme" id="theme" required>
{% for val,t in themes %}
<option value="{{ val }}" {% if default_theme == val %} selected="selected" {% endif %}>{{ t|raw }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="card-body d-grid gap-2">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="hidden" name="page" value="{{ page }}"/>
<input type="hidden" name="send" value="send"/>
<button class="btn btn-primary rounded-top-0" type="submit" name="dosave">
<i class="fa-regular fa-floppy-disk"></i>
{{ lng('menue.main.changetheme') }}
</button>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,142 @@
{% extends "Froxlor/userarea.html.twig" %}
{% block content %}
<h3 class="page-header">{{ lng('panel.profile') }}</h3>
<div class="row">
<div class="col-12 col-md-6 col-lg-4">
{# change password #}
<form action="{{ linker({'section':'index','page':'profile'}) }}"
class="col-12 max-w-420 d-flex flex-column"
method="post"
enctype="application/x-www-form-urlencoded">
<div class="card shadow">
<div class="card-body">
<h5 class="card-title"><i class="fa-solid fa-lock me-1"></i>{{ lng('menue.main.changepassword') }}</h5>
<div class="mb-3">
<label for="old_password"
class="col-form-label">{{ lng('changepassword.old_password') }}</label>
<input class="form-control" type="password" name="old_password" id="old_password"
value=""
required/>
</div>
<div class="mb-3">
<label for="new_password"
class="col-form-label">{{ lng('changepassword.new_password') }}</label>
<input class="form-control" type="password" name="new_password" id="new_password"
value=""
required/>
</div>
<div class="mb-3">
<label for="new_password_confirm"
class="col-form-label">{{ lng('changepassword.new_password_confirm') }}</label>
<input class="form-control" type="password" name="new_password_confirm"
id="new_password_confirm" value="" required/>
</div>
{% if userinfo.adminsession == 0 %}
<div class="mb-3">
<label for="change_main_ftp"
class="col-form-label">{{ lng('changepassword.also_change_ftp') }}</label>
<div class="form-check form-switch">
<input type="hidden" name="change_main_ftp" value="false">
<input class="form-check-input" type="checkbox" name="change_main_ftp"
id="change_main_ftp" value="true" checked>
</div>
</div>
<div class="mb-3">
<label for="change_stats"
class="col-form-label">{{ lng('changepassword.also_change_stats') }}</label>
<div class="form-check form-switch">
<input type="hidden" name="change_stats" value="false">
<input class="form-check-input" type="checkbox" name="change_stats"
id="change_stats" value="true" checked>
</div>
</div>
{% endif %}
</div>
<div class="card-body d-grid gap-2">
<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">
<i class="fa-regular fa-floppy-disk"></i>
{{ lng('menue.main.changepassword') }}</button>
</div>
</div>
</form>
</div>
{% if (get_setting('panel.allow_theme_change_admin') == '1' and userinfo.adminsession == 1) or (get_setting('panel.allow_theme_change_customer') == '1' and userinfo.adminsession == 0) %}
<div class="col-12 col-md-6 col-lg-4">
{# change theme #}
<form action="{{ linker({'section':'index','page':'profile'}) }}"
class="col-12 max-w-420 d-flex flex-column" method="post"
enctype="application/x-www-form-urlencoded">
<div class="card shadow">
<div class="card-body">
<h5 class="card-title"><i class="fa-solid fa-image me-1"></i>{{ lng('menue.main.changetheme') }}</h5>
<div>
<label for="theme" class="col-form-label">{{ lng('panel.theme') }}</label>
<select class="form-select" name="theme" id="theme" required>
{% for val,t in themes %}
<option
value="{{ val }}" {% if default_theme == val %} selected="selected" {% endif %}>{{ t|raw }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="card-body d-grid gap-2">
<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">
<i class="fa-regular fa-floppy-disk"></i>
{{ lng('menue.main.changetheme') }}
</button>
</div>
</div>
</form>
</div>
{% endif %}
<div class="col-12 col-md-6 col-lg-4">
{# change language #}
<form action="{{ linker({'section':'index','page':'profile'}) }}"
class="col-12 max-w-420 d-flex flex-column" method="post"
enctype="application/x-www-form-urlencoded">
<div class="card shadow">
<div class="card-body">
<h5 class="card-title"><i class="fa-solid fa-flag me-1"></i>{{ lng('menue.main.changelanguage') }}</h5>
<div>
<label for="def_language" class="col-form-label">{{ lng('login.language') }}</label>
<select class="form-select" name="def_language" id="def_language" required>
<option value="profile">{{ lng('login.profile_lng') }}</option>
{% for val,lang in languages %}
<option
value="{{ val }}" {% if default_lang == val %} selected="selected" {% endif %}>{{ lang|raw }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="card-body d-grid gap-2">
<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">
<i class="fa-regular fa-floppy-disk"></i>
{{ lng('menue.main.changelanguage') }}</button>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View File

@@ -51,25 +51,13 @@
</a> </a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarOpts"> <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarOpts">
<li> <li>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': 'change_password'}) }}"><i class="fa-solid fa-lock"></i> {{ lng('login.password') }}</a> <a class="dropdown-item" href="{{ linker({'section': 'index', 'page': 'profile'}) }}"><i class="fa-solid fa-user-gear"></i> {{ lng('panel.profile') }}</a>
</li>
<li>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': 'change_language'}) }}"><i class="fa-solid fa-flag"></i> {{ lng('login.language') }}</a>
</li> </li>
{% if get_setting('2fa.enabled') == 1 %} {% if get_setting('2fa.enabled') == 1 %}
<li> <li>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': '2fa'}) }}"><i class="fa-solid fa-shield"></i> {{ lng('2fa.2fa') }}</a> <a class="dropdown-item" href="{{ linker({'section': 'index', 'page': '2fa'}) }}"><i class="fa-solid fa-shield"></i> {{ lng('2fa.2fa') }}</a>
</li> </li>
{% endif %} {% endif %}
{% if get_setting('panel.allow_theme_change_admin') == '1' and userinfo.adminsession == 1 %}
<li>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': 'change_theme'}) }}"><i class="fa-solid fa-image"></i> {{ lng('panel.theme') }}</a>
</li>
{% elseif get_setting('panel.allow_theme_change_customer') == '1' and userinfo.adminsession == 0 %}
<li>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': 'change_theme'}) }}"><i class="fa-solid fa-image"></i> {{ lng('panel.theme') }}</a>
</li>
{% endif %}
{% if get_setting('api.enabled') == 1 and userinfo.api_allowed == 1 %} {% if get_setting('api.enabled') == 1 and userinfo.api_allowed == 1 %}
<li><hr class="dropdown-divider"></li> <li><hr class="dropdown-divider"></li>
<li> <li>