From a22b8f3dc73555800caf55768f04a7a2ce4af7f2 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 11 Mar 2017 15:24:34 -0500 Subject: Make user actions available from contextual menu --- app/Controller/TwoFactorController.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'app/Controller/TwoFactorController.php') diff --git a/app/Controller/TwoFactorController.php b/app/Controller/TwoFactorController.php index 73060c44..80f89fbd 100644 --- a/app/Controller/TwoFactorController.php +++ b/app/Controller/TwoFactorController.php @@ -100,10 +100,15 @@ class TwoFactorController extends UserViewController unset($this->sessionStorage->twoFactorSecret); $this->userSession->disablePostAuthentication(); - $this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id'])), true); } else { $this->flash->failure(t('The two factor authentication code is not valid.')); - $this->response->redirect($this->helper->url->to('TwoFactorController', 'show', array('user_id' => $user['id']))); + + if ($this->request->isAjax()) { + $this->show(); + } else { + $this->response->redirect($this->helper->url->to('TwoFactorController', 'show', array('user_id' => $user['id']))); + } } } @@ -127,7 +132,7 @@ class TwoFactorController extends UserViewController $this->userSession->disablePostAuthentication(); $this->flash->success(t('User updated successfully.')); - $this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id'])), true); } /** @@ -192,7 +197,7 @@ class TwoFactorController extends UserViewController 'twofactor_secret' => '', )); - $this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id']))); + $this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])), true); } else { $this->response->html($this->helper->layout->user('twofactor/disable', array( 'user' => $user, -- cgit v1.2.3