147 lines
7.0 KiB
Smarty
147 lines
7.0 KiB
Smarty
<script type="text/javascript">
|
|
function check_password() {ldelim}
|
|
const errorBlock = document.getElementById('js-error-block');
|
|
const errorText = document.getElementById('js-error-text');
|
|
|
|
errorBlock.classList.add('d-none');
|
|
|
|
let message = "";
|
|
let targetField = null;
|
|
|
|
if (document.getElementById('o_pass').value == '') {ldelim}
|
|
message = "{#LOGIN_OLD_PASS_EMPTY#}";
|
|
targetField = 'o_pass';
|
|
{rdelim}
|
|
else if (document.getElementById('n_pass').value == '') {ldelim}
|
|
message = "{#LOGIN_NEW_PASS_EMPTY#}";
|
|
targetField = 'n_pass';
|
|
{rdelim}
|
|
else if (document.getElementById('n_pass_c').value == '') {ldelim}
|
|
message = "{#LOGIN_NEW_PASSC#}";
|
|
targetField = 'n_pass_c';
|
|
{rdelim}
|
|
else if (document.getElementById('n_pass').value != document.getElementById('n_pass_c').value) {ldelim}
|
|
message = "{#LOGIN_PASSWORDS_NOEQU#}";
|
|
targetField = 'n_pass';
|
|
{rdelim}
|
|
|
|
if (message !== "") {ldelim}
|
|
errorText.innerText = message;
|
|
errorBlock.classList.remove('d-none');
|
|
|
|
errorBlock.classList.add('animate__shakeX');
|
|
setTimeout(() => errorBlock.classList.remove('animate__shakeX'), 500);
|
|
|
|
document.getElementById(targetField).focus();
|
|
return false;
|
|
{rdelim}
|
|
|
|
return true;
|
|
{rdelim}
|
|
</script>
|
|
|
|
<div class="container py-4">
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-6">
|
|
|
|
<div id="js-error-block" class="alert alert-danger shadow-sm border-0 mb-4 d-none animate__animated">
|
|
<div class="d-flex align-items-center">
|
|
<i class="bi bi-exclamation-circle fs-5 me-3"></i>
|
|
<div id="js-error-text"></div>
|
|
</div>
|
|
</div>
|
|
|
|
{if $changeok == 1}
|
|
<div class="alert alert-success shadow-sm border-0 mb-4 animate__animated animate__fadeIn">
|
|
<div class="d-flex align-items-center">
|
|
<i class="bi bi-check-circle-fill fs-2 me-3"></i>
|
|
<div>
|
|
<h4 class="h6 mb-1 fw-bold">{#LOGIN_PASSWORD_OK#}</h4>
|
|
<p class="mb-0 small opacity-75">{#LOGIN_AKTIV_NEW_PASS#}</p>
|
|
</div>
|
|
<a href="index.php?module=login&action=info" class="btn btn-sm btn-success ms-auto shadow-sm">{#LOGIN_NEW_PASS_REDIR#}</a>
|
|
</div>
|
|
</div>
|
|
{else}
|
|
|
|
<div class="card shadow-sm border-0">
|
|
<div class="card-header bg-primary text-white py-3 d-flex justify-content-between align-items-center">
|
|
<h2 class="h5 mb-0"><i class="bi bi-shield-lock me-2"></i> {#LOGIN_PASSWORD_CHANGE#}</h2>
|
|
<a href="index.php?module=login&action=info" class="btn btn-outline-light btn-sm fw-bold shadow-sm">
|
|
<i class="bi bi-x-lg me-1"></i> {#LOGIN_CANCEL#}
|
|
</a>
|
|
</div>
|
|
|
|
<div class="card-body p-4">
|
|
<p class="text-muted small mb-4">{#LOGIN_PASSWORD_INFO#}</p>
|
|
|
|
{if $errors}
|
|
<div class="alert alert-warning border-0 shadow-sm mb-4">
|
|
<ul class="mb-0 small">
|
|
{foreach from=$errors item=error}
|
|
<li><i class="bi bi-chevron-right me-1"></i> {$error}</li>
|
|
{/foreach}
|
|
</ul>
|
|
</div>
|
|
{/if}
|
|
|
|
<form method="post" action="{$ABS_PATH}index.php?module=login&action=change" onsubmit="return check_password();">
|
|
<input type="hidden" name="sub" value="send" />
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label small fw-bold text-muted text-uppercase">{#LOGIN_OLD_PASSWORD#}</label>
|
|
<div class="input-group">
|
|
<span class="input-group-text bg-light border-end-0"><i class="bi bi-key text-muted"></i></span>
|
|
<input type="password" name="old_pass" id="o_pass" class="form-control border-start-0" />
|
|
<button class="btn btn-outline-secondary border-start-0 toggle-password" type="button"><i class="bi bi-eye"></i></button>
|
|
</div>
|
|
</div>
|
|
|
|
<hr class="my-4 opacity-25">
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label small fw-bold text-muted text-uppercase">{#LOGIN_NEW_PASSWORD#}</label>
|
|
<div class="input-group">
|
|
<span class="input-group-text bg-light border-end-0"><i class="bi bi-lock text-primary"></i></span>
|
|
<input type="password" name="new_pass" id="n_pass" class="form-control border-start-0" />
|
|
<button class="btn btn-outline-secondary border-start-0 toggle-password" type="button"><i class="bi bi-eye"></i></button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label class="form-label small fw-bold text-muted text-uppercase">{#LOGIN_NEW_PASSWORD_C#}</label>
|
|
<div class="input-group">
|
|
<span class="input-group-text bg-light border-end-0"><i class="bi bi-check-all text-primary"></i></span>
|
|
<input type="password" name="new_pass_c" id="n_pass_c" class="form-control border-start-0" />
|
|
<button class="btn btn-outline-secondary border-start-0 toggle-password" type="button"><i class="bi bi-eye"></i></button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-grid">
|
|
<button class="btn btn-primary btn-lg shadow-sm fw-bold" type="submit">
|
|
{#LOGIN_CHANGE_PASSWORD#}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.querySelectorAll('.toggle-password').forEach(button => {
|
|
button.addEventListener('click', function() {
|
|
const input = this.parentElement.querySelector('input');
|
|
const icon = this.querySelector('i');
|
|
if (input.type === 'password') {
|
|
input.type = 'text';
|
|
icon.classList.replace('bi-eye', 'bi-eye-slash');
|
|
} else {
|
|
input.type = 'password';
|
|
icon.classList.replace('bi-eye-slash', 'bi-eye');
|
|
}
|
|
});
|
|
});
|
|
</script> |