Add forgot password feature

This commit is contained in:
Frederic Guillot
2016-01-09 17:28:31 -05:00
parent 03032c3190
commit 26e3996014
50 changed files with 997 additions and 33 deletions

View File

@@ -19,17 +19,22 @@
<?php if (isset($captcha) && $captcha): ?>
<?= $this->form->label(t('Enter the text below'), 'captcha') ?>
<img src="<?= $this->url->href('auth', 'captcha') ?>"/>
<?= $this->form->text('captcha', $values, $errors, array('required')) ?>
<img src="<?= $this->url->href('Captcha', 'image') ?>"/>
<?= $this->form->text('captcha', array(), $errors, array('required')) ?>
<?php endif ?>
<?php if (REMEMBER_ME_AUTH): ?>
<?= $this->form->checkbox('remember_me', t('Remember Me'), 1, true) ?><br/>
<?= $this->form->checkbox('remember_me', t('Remember Me'), 1, true) ?><br>
<?php endif ?>
<div class="form-actions">
<input type="submit" value="<?= t('Sign in') ?>" class="btn btn-blue"/>
</div>
<?php if ($this->app->config('password_reset') == 1): ?>
<div class="reset-password">
<?= $this->url->link(t('Forgot password?'), 'PasswordReset', 'create') ?>
</div>
<?php endif ?>
</form>
<?php endif ?>

View File

@@ -7,19 +7,21 @@
<?= $this->form->csrf() ?>
<?= $this->form->label(t('Application URL'), 'application_url') ?>
<?= $this->form->text('application_url', $values, $errors, array('placeholder="http://example.kanboard.net/"')) ?><br/>
<?= $this->form->text('application_url', $values, $errors, array('placeholder="http://example.kanboard.net/"')) ?>
<p class="form-help"><?= t('Example: http://example.kanboard.net/ (used by email notifications)') ?></p>
<?= $this->form->label(t('Language'), 'application_language') ?>
<?= $this->form->select('application_language', $languages, $values, $errors) ?><br/>
<?= $this->form->select('application_language', $languages, $values, $errors) ?>
<?= $this->form->label(t('Timezone'), 'application_timezone') ?>
<?= $this->form->select('application_timezone', $timezones, $values, $errors) ?><br/>
<?= $this->form->select('application_timezone', $timezones, $values, $errors) ?>
<?= $this->form->label(t('Date format'), 'application_date_format') ?>
<?= $this->form->select('application_date_format', $date_formats, $values, $errors) ?><br/>
<?= $this->form->select('application_date_format', $date_formats, $values, $errors) ?>
<p class="form-help"><?= t('ISO format is always accepted, example: "%s" and "%s"', date('Y-m-d'), date('Y_m_d')) ?></p>
<?= $this->form->checkbox('password_reset', t('Enable "Forget Password"'), 1, $values['password_reset'] == 1) ?>
<?= $this->form->label(t('Custom Stylesheet'), 'application_stylesheet') ?>
<?= $this->form->textarea('application_stylesheet', $values, $errors) ?><br/>

View File

@@ -0,0 +1,16 @@
<div class="form-login">
<h2><?= t('Password Reset') ?></h2>
<form method="post" action="<?= $this->url->href('PasswordReset', 'update', array('token' => $token)) ?>">
<?= $this->form->csrf() ?>
<?= $this->form->label(t('New password'), 'password') ?>
<?= $this->form->password('password', $values, $errors) ?><br/>
<?= $this->form->label(t('Confirmation'), 'confirmation') ?>
<?= $this->form->password('confirmation', $values, $errors) ?>
<div class="form-actions">
<input type="submit" value="<?= t('Change Password') ?>" class="btn btn-blue"/>
</div>
</form>
</div>

View File

@@ -0,0 +1,17 @@
<div class="form-login">
<h2><?= t('Password Reset') ?></h2>
<form method="post" action="<?= $this->url->href('PasswordReset', 'save') ?>">
<?= $this->form->csrf() ?>
<?= $this->form->label(t('Username'), 'username') ?>
<?= $this->form->text('username', $values, $errors, array('autofocus', 'required')) ?>
<?= $this->form->label(t('Enter the text below'), 'captcha') ?>
<img src="<?= $this->url->href('Captcha', 'image') ?>"/>
<?= $this->form->text('captcha', array(), $errors, array('required')) ?>
<div class="form-actions">
<input type="submit" value="<?= t('Change Password') ?>" class="btn btn-blue"/>
</div>
</form>
</div>

View File

@@ -0,0 +1,6 @@
<p><?= t('To reset your password click on this link:') ?></p>
<p><?= $this->url->to('PasswordReset', 'change', array('token' => $token), '', true) ?></p>
<hr>
Kanboard

View File

@@ -0,0 +1,26 @@
<div class="page-header">
<h2><?= t('Last Password Reset') ?></h2>
</div>
<?php if (empty($tokens)): ?>
<p class="alert"><?= t('The password has never been reinitialized.') ?></p>
<?php else: ?>
<table class="table-small table-fixed">
<tr>
<th class="column-20"><?= t('Creation') ?></th>
<th class="column-20"><?= t('Expiration') ?></th>
<th class="column-5"><?= t('Active') ?></th>
<th class="column-15"><?= t('IP address') ?></th>
<th><?= t('User agent') ?></th>
</tr>
<?php foreach ($tokens as $token): ?>
<tr>
<td><?= dt('%B %e, %Y at %k:%M %p', $token['date_creation']) ?></td>
<td><?= dt('%B %e, %Y at %k:%M %p', $token['date_expiration']) ?></td>
<td><?= $token['is_active'] == 0 ? t('No') : t('Yes') ?></td>
<td><?= $this->e($token['ip']) ?></td>
<td><?= $this->e($token['user_agent']) ?></td>
</tr>
<?php endforeach ?>
</table>
<?php endif ?>

View File

@@ -19,6 +19,9 @@
<li <?= $this->app->checkMenuSelection('user', 'sessions') ?>>
<?= $this->url->link(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('user', 'passwordReset') ?>>
<?= $this->url->link(t('Password reset history'), 'user', 'passwordReset', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?= $this->hook->render('template:user:sidebar:information') ?>