summaryrefslogtreecommitdiff
path: root/app/Controller/Twofactor.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-11-15 12:50:33 -0500
committerFrederic Guillot <fred@kanboard.net>2015-11-15 12:50:33 -0500
commita675271ad71b7713d1b33bdba3c51b2b04813229 (patch)
treee54d8a95e16ca521193b9fd5a5eb071aa2910823 /app/Controller/Twofactor.php
parent2fc402f6733573627ad25394d109b9f848ef04f6 (diff)
Rewrite of session management
Diffstat (limited to 'app/Controller/Twofactor.php')
-rw-r--r--app/Controller/Twofactor.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/Controller/Twofactor.php b/app/Controller/Twofactor.php
index 179241f8..a7368d6b 100644
--- a/app/Controller/Twofactor.php
+++ b/app/Controller/Twofactor.php
@@ -72,9 +72,9 @@ class Twofactor extends User
}
// Allow the user to test or disable the feature
- $_SESSION['user']['twofactor_activated'] = false;
+ $this->userSession->disable2FA();
- $this->session->flash(t('User updated successfully.'));
+ $this->flash->success(t('User updated successfully.'));
$this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id'])));
}
@@ -92,9 +92,9 @@ class Twofactor extends User
$values = $this->request->getValues();
if (! empty($values['code']) && $otp->checkTotp(Base32::decode($user['twofactor_secret']), $values['code'])) {
- $this->session->flash(t('The two factor authentication code is valid.'));
+ $this->flash->success(t('The two factor authentication code is valid.'));
} else {
- $this->session->flashError(t('The two factor authentication code is not valid.'));
+ $this->flash->failure(t('The two factor authentication code is not valid.'));
}
$this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id'])));
@@ -114,11 +114,11 @@ class Twofactor extends User
$values = $this->request->getValues();
if (! empty($values['code']) && $otp->checkTotp(Base32::decode($user['twofactor_secret']), $values['code'])) {
- $this->session['2fa_validated'] = true;
- $this->session->flash(t('The two factor authentication code is valid.'));
+ $this->sessionStorage->postAuth['validated'] = true;
+ $this->flash->success(t('The two factor authentication code is valid.'));
$this->response->redirect($this->helper->url->to('app', 'index'));
} else {
- $this->session->flashError(t('The two factor authentication code is not valid.'));
+ $this->flash->failure(t('The two factor authentication code is not valid.'));
$this->response->redirect($this->helper->url->to('twofactor', 'code'));
}
}