Reset failed login counter and unlock user when changing password

This commit is contained in:
Frederic Guillot
2016-05-18 21:27:36 -04:00
parent 0830fe22b7
commit bfd59d9e54
11 changed files with 214 additions and 147 deletions

View File

@@ -1,7 +1,7 @@
<div class="page-header">
<h2><?= t('Edit Authentication') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('UserViewController', 'authentication', array('user_id' => $user['id'])) ?>" autocomplete="off">
<form method="post" action="<?= $this->url->href('UserCredentialController', 'saveAuthentication', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>

View File

@@ -2,15 +2,12 @@
<h2><?= t('Password modification') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('UserViewController', 'password', array('user_id' => $user['id'])) ?>" autocomplete="off">
<form method="post" action="<?= $this->url->href('UserCredentialController', 'savePassword', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->csrf() ?>
<div class="alert alert-error">
<?= $this->form->label(t('Current password for the user "%s"', $this->user->getFullname()), 'current_password') ?>
<?= $this->form->password('current_password', $values, $errors) ?>
</div>
<?= $this->form->label(t('Current password for the user "%s"', $this->user->getFullname()), 'current_password') ?>
<?= $this->form->password('current_password', $values, $errors) ?>
<?= $this->form->label(t('New password for the user "%s"', $this->user->getFullname($user)), 'password') ?>
<?= $this->form->password('password', $values, $errors) ?>

View File

@@ -1,7 +1,7 @@
<div class="page-header">
<h2><?= t('Edit user') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('UserViewController', 'edit', array('user_id' => $user['id'])) ?>" autocomplete="off">
<form method="post" action="<?= $this->url->href('UserModificationController', 'save', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>

View File

@@ -15,6 +15,10 @@
<li><?= t('Role:') ?> <strong><?= $this->user->getRoleName($user['role']) ?></strong></li>
<li><?= t('Account type:') ?> <strong><?= $user['is_ldap_user'] ? t('Remote') : t('Local') ?></strong></li>
<li><?= $user['twofactor_activated'] == 1 ? t('Two factor authentication enabled') : t('Two factor authentication disabled') ?></li>
<li><?= t('Number of failed login:') ?> <strong><?= $user['nb_failed_login'] ?></strong></li>
<?php if ($user['lock_expiration_date'] != 0): ?>
<li><?= t('Account locked until:') ?> <strong><?= $this->dt->datetime($user['lock_expiration_date']) ?></strong></li>
<?php endif ?>
</ul>
<div class="page-header">

View File

@@ -33,9 +33,9 @@
<ul>
<?php if ($this->user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?>
<?php if ($this->user->hasAccess('UserViewController', 'edit')): ?>
<li <?= $this->app->checkMenuSelection('UserViewController', 'edit') ?>>
<?= $this->url->link(t('Edit profile'), 'UserViewController', 'edit', array('user_id' => $user['id'])) ?>
<?php if ($this->user->hasAccess('UserModificationController', 'show')): ?>
<li <?= $this->app->checkMenuSelection('UserModificationController', 'show') ?>>
<?= $this->url->link(t('Edit profile'), 'UserModificationController', 'show', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('AvatarFile') ?>>
<?= $this->url->link(t('Avatar'), 'AvatarFile', 'show', array('user_id' => $user['id'])) ?>
@@ -43,8 +43,8 @@
<?php endif ?>
<?php if ($user['is_ldap_user'] == 0): ?>
<li <?= $this->app->checkMenuSelection('UserViewController', 'password') ?>>
<?= $this->url->link(t('Change password'), 'UserViewController', 'password', array('user_id' => $user['id'])) ?>
<li <?= $this->app->checkMenuSelection('UserCredentialController', 'changePassword') ?>>
<?= $this->url->link(t('Change password'), 'UserCredentialController', 'changePassword', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
@@ -72,9 +72,9 @@
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('UserViewController', 'authentication')): ?>
<li <?= $this->app->checkMenuSelection('UserViewController', 'authentication') ?>>
<?= $this->url->link(t('Edit Authentication'), 'UserViewController', 'authentication', array('user_id' => $user['id'])) ?>
<?php if ($this->user->hasAccess('UserCredentialController', 'changeAuthentication')): ?>
<li <?= $this->app->checkMenuSelection('UserCredentialController', 'changeAuthentication') ?>>
<?= $this->url->link(t('Edit Authentication'), 'UserCredentialController', 'changeAuthentication', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>