summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-09 17:28:31 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-09 17:28:31 -0500
commit26e3996014936268f4acbfa214fa881af9320ddd (patch)
tree5f7fa2c1b73e4443ce75e8919383bdf775492304 /app/Template
parent03032c3190a27408d60e27f486a4ca472448e9dc (diff)
Add forgot password feature
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/auth/index.php11
-rw-r--r--app/Template/config/application.php10
-rw-r--r--app/Template/password_reset/change.php16
-rw-r--r--app/Template/password_reset/create.php17
-rw-r--r--app/Template/password_reset/email.php6
-rw-r--r--app/Template/user/password_reset.php26
-rw-r--r--app/Template/user/sidebar.php3
7 files changed, 82 insertions, 7 deletions
diff --git a/app/Template/auth/index.php b/app/Template/auth/index.php
index 2f75b113..a1059d6f 100644
--- a/app/Template/auth/index.php
+++ b/app/Template/auth/index.php
@@ -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 ?>
diff --git a/app/Template/config/application.php b/app/Template/config/application.php
index 7d4c811d..ec7d8462 100644
--- a/app/Template/config/application.php
+++ b/app/Template/config/application.php
@@ -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/>
diff --git a/app/Template/password_reset/change.php b/app/Template/password_reset/change.php
new file mode 100644
index 00000000..310f0f97
--- /dev/null
+++ b/app/Template/password_reset/change.php
@@ -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> \ No newline at end of file
diff --git a/app/Template/password_reset/create.php b/app/Template/password_reset/create.php
new file mode 100644
index 00000000..ef958011
--- /dev/null
+++ b/app/Template/password_reset/create.php
@@ -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> \ No newline at end of file
diff --git a/app/Template/password_reset/email.php b/app/Template/password_reset/email.php
new file mode 100644
index 00000000..62788b49
--- /dev/null
+++ b/app/Template/password_reset/email.php
@@ -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 \ No newline at end of file
diff --git a/app/Template/user/password_reset.php b/app/Template/user/password_reset.php
new file mode 100644
index 00000000..b4c9a0c4
--- /dev/null
+++ b/app/Template/user/password_reset.php
@@ -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 ?> \ No newline at end of file
diff --git a/app/Template/user/sidebar.php b/app/Template/user/sidebar.php
index 7756126e..9f745568 100644
--- a/app/Template/user/sidebar.php
+++ b/app/Template/user/sidebar.php
@@ -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') ?>