forgot-password function on login

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-02-16 21:08:25 +01:00
parent 14111583f1
commit f930565d45
6 changed files with 77 additions and 11 deletions

View File

@@ -331,12 +331,6 @@ if ($action == '2fa_entercode') {
}
exit();
} else {
$language_options = '';
$language_options .= \Froxlor\UI\HTML::makeoption($lng['login']['profile_lng'], 'profile', 'profile', true, true);
foreach ($languages as $language_file => $language_name) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, 'profile', true);
}
$smessage = isset($_GET['showmessage']) ? (int) $_GET['showmessage'] : 0;
$message = '';
@@ -393,6 +387,7 @@ if ($action == '2fa_entercode') {
UI::TwigBuffer('login/login.html.twig', [
'pagetitle' => 'Login',
'languages' => $languages,
'lastscript' => $lastscript,
'lastqrystr' => $lastqrystr,
'upd_in_progress' => $update_in_progress,
@@ -590,7 +585,12 @@ if ($action == 'forgotpwd') {
}
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate('fpwd') . "\";");
UI::TwigBuffer('login/fpwd.html.twig', [
'pagetitle' => $lng['login']['presend'],
'action' => $action,
'message' => $message,
]);
UI::TwigOutputBuffer();
}
if ($action == 'resetpwd') {

View File

@@ -44,6 +44,7 @@ $lng['login']['language'] = 'Language';
$lng['login']['login'] = 'Login';
$lng['login']['logout'] = 'Logout';
$lng['login']['profile_lng'] = 'Profile language';
$lng['login']['welcomemsg'] = 'Please log in to access your account.';
/**
* Customer

View File

@@ -44,6 +44,7 @@ $lng['login']['language'] = 'Sprache';
$lng['login']['login'] = 'Anmelden';
$lng['login']['logout'] = 'Abmelden';
$lng['login']['profile_lng'] = 'Profilsprache';
$lng['login']['welcomemsg'] = 'Bitte melden Sie sich an, um auf Ihr Konto zuzugreifen.';
/**
* Customer

View File

@@ -0,0 +1,55 @@
{% extends "Froxlor/base.html.twig" %}
{% set body_class = "min-vh-100 d-flex align-items-center" %}
{% block body %}
<div class="container">
<div class="row justify-content-center">
<form class="col-12 col-md-4 d-flex flex-column" method="post" enctype="application/x-www-form-urlencoded">
<img class="align-self-center mb-5" src="{{ header_logo_login }}" alt="Froxlor Server Management Panel"/>
<div class="card shadow">
<div class="card-body">
<h5 class="card-title">{{ pagetitle }}</h5>
{% 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 %}
<div class="mb-3">
<label for="loginname" class="col-form-label">{{ lng('login.username') }}</label>
<input class="form-control" type="text" name="loginname" id="loginname" value="" required/>
</div>
<div class="mb-3">
<label for="loginemail" class="col-form-label">{{ lng('login.email') }}</label>
<input class="form-control" type="email" name="loginemail" id="loginemail" value="" required/>
</div>
</div>
<div class="card-body d-grid gap-2">
<input type="hidden" name="action" value="{{ action }}" />
<input type="hidden" name="send" value="send" />
<button class="btn btn-primary rounded-top-0" type="submit" name="doremind">{{ lng('login.remind') }}</button>
</div>
<div class="card-footer">
<a class="card-link text-muted" href="index.php"><i class="fa-solid fa-angles-left"></i> {{ lng('login.backtologin') }}</a>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View File

@@ -11,7 +11,7 @@
<div class="card shadow">
<div class="card-body">
<h5 class="card-title">{{ pagetitle }}</h5>
<p>Please log in to access your Account.</p>
<p>{{ lng('login.welcomemsg') }}</p>
{% if upd_in_progress %}
<div class="alert alert-warning" role="alert">
@@ -41,8 +41,11 @@
<div>
<label for="language" class="col-form-label">{{ lng('login.language') }}</label>
<select class="form-control" name="language" id="language" required>
<option value="de">Deutsch</option>
<select class="form-select" name="language" id="language" required>
<option value="profile">{{ lng('login.profile_lng') }}</option>
{% for val,lang in languages %}
<option value="{{ val }}">{{ lang|raw }}</option>
{% endfor %}
</select>
</div>
</div>
@@ -53,6 +56,12 @@
<input type="hidden" name="send" value="send" />
<button class="btn btn-primary rounded-top-0" type="submit" name="dologin">{{ lng('login.login') }}</button>
</div>
{% if get_setting('panel.allow_preset') == '1' %}
<div class="card-footer">
<a class="card-link text-muted" href="index.php?action=forgotpwd">{{ lng('login.forgotpwd') }}</a>
</div>
{% endif %}
</div>
</form>
</div>

View File

@@ -28,7 +28,7 @@
<div class="collapse navbar-collapse justify-content-end px-3" id="navbarTop">
<ul class="navbar-nav align-items-center">
<li class="nav-item text-nowrap d-block me-2">
<a class="btn btn-secondary btn-sm d-block" href="{{ linker({'section': 'index'}) }}">
<a class="btn btn-primary btn-sm d-block" href="{{ linker({'section': 'index'}) }}">
<i class="fa fa-dashboard"></i> {{ lng('panel.dashboard') }}
</a>
</li>