Add two factor authentication
This commit is contained in:
10
app/Template/twofactor/check.php
Normal file
10
app/Template/twofactor/check.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<form method="post" action="<?= $this->u('twofactor', 'check', array('user_id' => $this->userSession->getId())) ?>" autocomplete="off">
|
||||
|
||||
<?= $this->formCsrf() ?>
|
||||
<?= $this->formLabel(t('Code'), 'code') ?>
|
||||
<?= $this->formText('code', array(), array(), array('placeholder="123456"'), 'form-numeric') ?>
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Check my code') ?>" class="btn btn-blue"/>
|
||||
</div>
|
||||
</form>
|
||||
37
app/Template/twofactor/index.php
Normal file
37
app/Template/twofactor/index.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<div class="page-header">
|
||||
<h2><?= t('Two factor authentication') ?></h2>
|
||||
</div>
|
||||
|
||||
<form method="post" action="<?= $this->u('twofactor', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off">
|
||||
|
||||
<?= $this->formCsrf() ?>
|
||||
<?= $this->formCheckbox('twofactor_activated', t('Enable/disable two factor authentication'), 1, isset($user['twofactor_activated']) && $user['twofactor_activated'] == 1) ?>
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php if ($user['twofactor_activated'] == 1): ?>
|
||||
<div class="listing">
|
||||
<p><?= t('Secret key: ') ?><strong><?= $this->e($user['twofactor_secret']) ?></strong> (base32)</p>
|
||||
<p><br/><img src="<?= $qrcode_url ?>"/><br/><br/></p>
|
||||
<p>
|
||||
<?= t('This QR Ccde contains the key URI: ') ?><strong><?= $this->e($key_url) ?></strong>
|
||||
<br/><br/>
|
||||
<?= t('Save the secret key in your TOTP software (by example Google Authenticator or FreeOTP).') ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h3><?= t('Test your device') ?></h3>
|
||||
<form method="post" action="<?= $this->u('twofactor', 'test', array('user_id' => $user['id'])) ?>" autocomplete="off">
|
||||
|
||||
<?= $this->formCsrf() ?>
|
||||
<?= $this->formLabel(t('Code'), 'code') ?>
|
||||
<?= $this->formText('code', array(), array(), array('placeholder="123456"'), 'form-numeric') ?>
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Check my code') ?>" class="btn btn-blue"/>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
@@ -17,6 +17,7 @@
|
||||
<th><?= $paginator->order(t('Name'), 'name') ?></th>
|
||||
<th><?= $paginator->order(t('Email'), 'email') ?></th>
|
||||
<th><?= $paginator->order(t('Administrator'), 'is_admin') ?></th>
|
||||
<th><?= $paginator->order(t('Two factor authentication'), 'twofactor_activated') ?></th>
|
||||
<th><?= $paginator->order(t('Default project'), 'default_project_id') ?></th>
|
||||
<th><?= $paginator->order(t('Notifications'), 'notifications_enabled') ?></th>
|
||||
<th><?= t('External accounts') ?></th>
|
||||
@@ -39,6 +40,9 @@
|
||||
<td>
|
||||
<?= $user['is_admin'] ? t('Yes') : t('No') ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $user['twofactor_activated'] ? t('Yes') : t('No') ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= (isset($user['default_project_id']) && isset($projects[$user['default_project_id']])) ? $this->e($projects[$user['default_project_id']]) : t('None'); ?>
|
||||
</td>
|
||||
|
||||
@@ -1,10 +1,32 @@
|
||||
<div class="sidebar">
|
||||
<h2><?= t('Actions') ?></h2>
|
||||
<h2><?= t('Information') ?></h2>
|
||||
<ul>
|
||||
<li>
|
||||
<?= $this->a(t('Summary'), 'user', 'show', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php if ($this->userSession->isAdmin()): ?>
|
||||
<li>
|
||||
<?= $this->a(t('User dashboard'), 'app', 'dashboard', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('User calendar'), 'user', 'calendar', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if ($this->userSession->isAdmin() || $this->userSession->isCurrentUser($user['id'])): ?>
|
||||
<li>
|
||||
<?= $this->a(t('Time tracking'), 'user', 'timesheet', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('Last logins'), 'user', 'last', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
|
||||
<h2><?= t('Actions') ?></h2>
|
||||
<ul>
|
||||
<?php if ($this->userSession->isAdmin() || $this->userSession->isCurrentUser($user['id'])): ?>
|
||||
<li>
|
||||
<?= $this->a(t('Edit profile'), 'user', 'edit', array('user_id' => $user['id'])) ?>
|
||||
@@ -16,30 +38,21 @@
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($this->userSession->isCurrentUser($user['id'])): ?>
|
||||
<li>
|
||||
<?= $this->a(t('Two factor authentication'), 'twofactor', 'index', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<li>
|
||||
<?= $this->a(t('Email notifications'), 'user', 'notifications', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('External accounts'), 'user', 'external', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('Last logins'), 'user', 'last', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('Time tracking'), 'user', 'timesheet', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($this->userSession->isAdmin()): ?>
|
||||
<li>
|
||||
<?= $this->a(t('User dashboard'), 'app', 'dashboard', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('User calendar'), 'user', 'calendar', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('Hourly rates'), 'hourlyrate', 'index', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user