summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-04-21 19:53:33 -0400
committerFrederic Guillot <fred@kanboard.net>2015-04-21 19:53:33 -0400
commit71112eb81d28b7baee09bf7d73e80a81cb38c17a (patch)
tree7bab960f33a2ed54a3976b800417ad0fb3bc5b33 /app
parente30bf47d94e84efe42c05148dddd6cec499d12ae (diff)
Allow admins to disable the 2FA for a standard user
Diffstat (limited to 'app')
-rw-r--r--app/Controller/Twofactor.php27
-rw-r--r--app/Locale/da_DK/translations.php2
-rw-r--r--app/Locale/de_DE/translations.php2
-rw-r--r--app/Locale/es_ES/translations.php2
-rw-r--r--app/Locale/fi_FI/translations.php2
-rw-r--r--app/Locale/fr_FR/translations.php2
-rw-r--r--app/Locale/hu_HU/translations.php2
-rw-r--r--app/Locale/it_IT/translations.php2
-rw-r--r--app/Locale/ja_JP/translations.php2
-rw-r--r--app/Locale/nl_NL/translations.php2
-rw-r--r--app/Locale/pl_PL/translations.php2
-rw-r--r--app/Locale/pt_BR/translations.php2
-rw-r--r--app/Locale/ru_RU/translations.php2
-rw-r--r--app/Locale/sr_Latn_RS/translations.php2
-rw-r--r--app/Locale/sv_SE/translations.php2
-rw-r--r--app/Locale/th_TH/translations.php2
-rw-r--r--app/Locale/tr_TR/translations.php2
-rw-r--r--app/Locale/zh_CN/translations.php2
-rw-r--r--app/Model/Acl.php1
-rw-r--r--app/Template/twofactor/disable.php14
-rw-r--r--app/Template/user/sidebar.php4
21 files changed, 80 insertions, 0 deletions
diff --git a/app/Controller/Twofactor.php b/app/Controller/Twofactor.php
index e3451d33..c21729ba 100644
--- a/app/Controller/Twofactor.php
+++ b/app/Controller/Twofactor.php
@@ -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,
+ )));
+ }
}
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index f1352b8d..f06f87c1 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 2fc01f3e..1d43cf0c 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index c150bfe5..cd636f78 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index 99ead93c..9ca386d6 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 709131a6..c05dd689 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -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 » ?',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index d2d0d6e9..f07b691c 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index c2882ffc..0ccefe55 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index a35ff2e9..644dcfa7 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index 06a7026a..e0285fdd 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index c91d4ba1..39c92379 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 1e5dae59..223850fc 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 53616d9a..6f350a82 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index fd5c4f5d..7dcb6f99 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index 7f765815..f3d58696 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index f282beee..552e2f43 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index 11cba833..e4efe258 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -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"?' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index 09df6d45..a51a54d3 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -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"?' => '',
);
diff --git a/app/Model/Acl.php b/app/Model/Acl.php
index d0e7352a..d7b96b06 100644
--- a/app/Model/Acl.php
+++ b/app/Model/Acl.php
@@ -74,6 +74,7 @@ class Acl extends Base
'project' => array('remove'),
'hourlyrate' => '*',
'currency' => '*',
+ 'twofactor' => array('disable'),
);
/**
diff --git a/app/Template/twofactor/disable.php b/app/Template/twofactor/disable.php
new file mode 100644
index 00000000..6909b446
--- /dev/null
+++ b/app/Template/twofactor/disable.php
@@ -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> \ No newline at end of file
diff --git a/app/Template/user/sidebar.php b/app/Template/user/sidebar.php
index f794c609..ff0fb009 100644
--- a/app/Template/user/sidebar.php
+++ b/app/Template/user/sidebar.php
@@ -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>