diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-04-21 19:53:33 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-04-21 19:53:33 -0400 |
commit | 71112eb81d28b7baee09bf7d73e80a81cb38c17a (patch) | |
tree | 7bab960f33a2ed54a3976b800417ad0fb3bc5b33 /app/Controller/Twofactor.php | |
parent | e30bf47d94e84efe42c05148dddd6cec499d12ae (diff) |
Allow admins to disable the 2FA for a standard user
Diffstat (limited to 'app/Controller/Twofactor.php')
-rw-r--r-- | app/Controller/Twofactor.php | 27 |
1 files changed, 27 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, + ))); + } } |