diff options
Diffstat (limited to 'app/Controller')
-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, + ))); + } } |