70 lines
2.3 KiB
PHTML
70 lines
2.3 KiB
PHTML
<?php
|
|
|
|
/**
|
|
* @var array<int, string> $errors
|
|
* @var array<int, array{label:string,key:string}> $passwordHints
|
|
* @var int $passwordMinLength
|
|
*/
|
|
|
|
use MintyPHP\Buffer;
|
|
use MintyPHP\Session;
|
|
|
|
Buffer::set('title', t('Reset password'));
|
|
?>
|
|
|
|
<article>
|
|
<header>
|
|
<img src="<?php e(appLogoUrl(128)); ?>" alt="<?php e(appTitle()); ?>" class="brand-logo" style="margin-bottom:1rem;">
|
|
<hgroup>
|
|
<h1><?php e(t('Reset password')); ?></h1>
|
|
<p><?php e(t('Choose a new password for your account.')); ?></p>
|
|
</hgroup>
|
|
</header>
|
|
<form method="post">
|
|
<fieldset>
|
|
<legend>
|
|
<small>
|
|
<?php e(t('Password')); ?>
|
|
</small>
|
|
</legend>
|
|
<label for="password">
|
|
<span><?php e(t('Password')); ?></span>
|
|
<input required type="password" name="password" id="password"
|
|
minlength="<?php e($passwordMinLength ?? 8); ?>" />
|
|
</label>
|
|
<label for="password2">
|
|
<span><?php e(t('Password (again)')); ?></span>
|
|
<input required type="password" name="password2" id="password2"
|
|
minlength="<?php e($passwordMinLength ?? 8); ?>" />
|
|
</label>
|
|
<?php if (!empty($passwordHints)): ?>
|
|
<div class="form-hint" data-password-hints data-password-input="#password" data-confirm-input="#password2"
|
|
data-min-length="<?php e($passwordMinLength ?? 8); ?>">
|
|
<strong><?php e(t('Password requirements')); ?></strong>
|
|
<ul class="form-hint-list">
|
|
<?php foreach ($passwordHints as $hint): ?>
|
|
<li data-rule="<?php e($hint['rule']); ?>"><?php e($hint['text']); ?></li>
|
|
<?php endforeach; ?>
|
|
<li data-rule="match"><?php e(t('Passwords must match')); ?></li>
|
|
</ul>
|
|
</div>
|
|
<?php endif; ?>
|
|
</fieldset>
|
|
<?php if (!empty($errors)): ?>
|
|
<div class="notice" data-variant="error">
|
|
<ul>
|
|
<?php foreach ($errors as $error): ?>
|
|
<li><?php e($error); ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div>
|
|
<?php endif; ?>
|
|
<button type="submit"><?php e(t('Reset password')); ?></button>
|
|
<?php Session::getCsrfInput(); ?>
|
|
</form>
|
|
<hr>
|
|
<p class="text-align-center">
|
|
<a href="<?php e(lurl('login')); ?>"><?php e(t('Back to Login')); ?></a>
|
|
</p>
|
|
</article>
|