Allow admins to disable the 2FA for a standard user
This commit is contained in:
parent
e30bf47d94
commit
71112eb81d
|
|
@ -137,4 +137,31 @@ class Twofactor extends User
|
|||
'title' => t('Check two factor authentication code'),
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable 2FA for a user
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function disable()
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
if ($this->request->getStringParam('disable') === 'yes') {
|
||||
|
||||
$this->checkCSRFParam();
|
||||
|
||||
$this->user->update(array(
|
||||
'id' => $user['id'],
|
||||
'twofactor_activated' => 0,
|
||||
'twofactor_secret' => '',
|
||||
));
|
||||
|
||||
$this->response->redirect($this->helper->url('user', 'show', array('user_id' => $user['id'])));
|
||||
}
|
||||
|
||||
$this->response->html($this->layout('twofactor/disable', array(
|
||||
'user' => $user,
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -868,4 +868,6 @@ return array(
|
|||
'Help on Mailgun integration' => 'Aide sur l\'intégration avec Mailgun',
|
||||
'Sendgrid (incoming emails)' => 'Sendgrid (emails entrants)',
|
||||
'Help on Sendgrid integration' => 'Aide sur l\'intégration avec Sendgrid',
|
||||
'Disable two factor authentication' => 'Désactiver l\'authentification à deux facteurs',
|
||||
'Do you really want to disable the two factor authentication for this user: "%s"?' => 'Voulez-vous vraiment désactiver l\'authentification à deux facteurs pour cet utilisateur : « %s » ?',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -866,4 +866,6 @@ return array(
|
|||
// 'Help on Mailgun integration' => '',
|
||||
// 'Sendgrid (incoming emails)' => '',
|
||||
// 'Help on Sendgrid integration' => '',
|
||||
// 'Disable two factor authentication' => '',
|
||||
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ class Acl extends Base
|
|||
'project' => array('remove'),
|
||||
'hourlyrate' => '*',
|
||||
'currency' => '*',
|
||||
'twofactor' => array('disable'),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<div class="page-header">
|
||||
<h2><?= t('Disable two factor authentication') ?></h2>
|
||||
</div>
|
||||
|
||||
<div class="confirm">
|
||||
<p class="alert alert-info">
|
||||
<?= t('Do you really want to disable the two factor authentication for this user: "%s"?', $user['name'] ?: $user['username']) ?>
|
||||
</p>
|
||||
|
||||
<div class="form-actions">
|
||||
<?= $this->a(t('Yes'), 'twofactor', 'disable', array('user_id' => $user['id'], 'disable' => 'yes'), true, 'btn btn-red') ?>
|
||||
<?= t('or') ?> <?= $this->a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -42,6 +42,10 @@
|
|||
<li>
|
||||
<?= $this->a(t('Two factor authentication'), 'twofactor', 'index', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php elseif ($this->userSession->isAdmin() && $user['twofactor_activated'] == 1): ?>
|
||||
<li>
|
||||
<?= $this->a(t('Two factor authentication'), 'twofactor', 'disable', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue