From 33dea152fc6b0c061b1f61060cc75710dd0ec236 Mon Sep 17 00:00:00 2001
From: Frederic Guillot
Date: Thu, 26 May 2016 21:05:54 -0400
Subject: [PATCH] Rename 2FA controller
---
.../{Twofactor.php => TwoFactorController.php} | 12 ++++++------
app/Middleware/PostAuthenticationMiddleware.php | 4 ++--
app/ServiceProvider/AuthenticationProvider.php | 2 +-
app/ServiceProvider/RouteProvider.php | 2 +-
app/Template/twofactor/check.php | 4 ++--
app/Template/twofactor/disable.php | 2 +-
app/Template/twofactor/index.php | 2 +-
app/Template/twofactor/show.php | 4 ++--
app/Template/user_view/sidebar.php | 10 +++++-----
9 files changed, 21 insertions(+), 21 deletions(-)
rename app/Controller/{Twofactor.php => TwoFactorController.php} (91%)
diff --git a/app/Controller/Twofactor.php b/app/Controller/TwoFactorController.php
similarity index 91%
rename from app/Controller/Twofactor.php
rename to app/Controller/TwoFactorController.php
index 118613b24..c8540f856 100644
--- a/app/Controller/Twofactor.php
+++ b/app/Controller/TwoFactorController.php
@@ -7,10 +7,10 @@ use Kanboard\Core\Controller\AccessForbiddenException;
/**
* Two Factor Auth controller
*
- * @package controller
+ * @package Kanboard/Controller
* @author Frederic Guillot
*/
-class Twofactor extends UserViewController
+class TwoFactorController extends UserViewController
{
/**
* Only the current user can access to 2FA settings
@@ -100,10 +100,10 @@ class Twofactor extends UserViewController
unset($this->sessionStorage->twoFactorSecret);
$this->userSession->disablePostAuthentication();
- $this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id'])));
+ $this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id'])));
} else {
$this->flash->failure(t('The two factor authentication code is not valid.'));
- $this->response->redirect($this->helper->url->to('twofactor', 'show', array('user_id' => $user['id'])));
+ $this->response->redirect($this->helper->url->to('TwoFactorController', 'show', array('user_id' => $user['id'])));
}
}
@@ -127,7 +127,7 @@ class Twofactor extends UserViewController
$this->userSession->disablePostAuthentication();
$this->flash->success(t('User updated successfully.'));
- $this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id'])));
+ $this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id'])));
}
/**
@@ -152,7 +152,7 @@ class Twofactor extends UserViewController
$this->response->redirect($this->helper->url->to('DashboardController', 'show'));
} else {
$this->flash->failure(t('The two factor authentication code is not valid.'));
- $this->response->redirect($this->helper->url->to('twofactor', 'code'));
+ $this->response->redirect($this->helper->url->to('TwoFactorController', 'code'));
}
}
diff --git a/app/Middleware/PostAuthenticationMiddleware.php b/app/Middleware/PostAuthenticationMiddleware.php
index c1237f47e..650d47aa3 100644
--- a/app/Middleware/PostAuthenticationMiddleware.php
+++ b/app/Middleware/PostAuthenticationMiddleware.php
@@ -19,7 +19,7 @@ class PostAuthenticationMiddleware extends BaseMiddleware
{
$controller = strtolower($this->router->getController());
$action = strtolower($this->router->getAction());
- $ignore = ($controller === 'twofactor' && in_array($action, array('code', 'check'))) || ($controller === 'auth' && $action === 'logout');
+ $ignore = ($controller === 'twofactorcontroller' && in_array($action, array('code', 'check'))) || ($controller === 'auth' && $action === 'logout');
if ($ignore === false && $this->userSession->hasPostAuthentication() && ! $this->userSession->isPostAuthenticationValidated()) {
$this->nextMiddleware = null;
@@ -28,7 +28,7 @@ class PostAuthenticationMiddleware extends BaseMiddleware
$this->response->text('Not Authorized', 401);
}
- $this->response->redirect($this->helper->url->to('twofactor', 'code'));
+ $this->response->redirect($this->helper->url->to('TwoFactorController', 'code'));
}
$this->next();
diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php
index 051dcc306..3b5a9bab0 100644
--- a/app/ServiceProvider/AuthenticationProvider.php
+++ b/app/ServiceProvider/AuthenticationProvider.php
@@ -140,7 +140,7 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->add('Link', '*', Role::APP_ADMIN);
$acl->add('ProjectCreation', 'create', Role::APP_MANAGER);
$acl->add('Projectuser', '*', Role::APP_MANAGER);
- $acl->add('Twofactor', 'disable', Role::APP_ADMIN);
+ $acl->add('TwoFactorController', 'disable', Role::APP_ADMIN);
$acl->add('UserImportController', '*', Role::APP_ADMIN);
$acl->add('UserCreationController', '*', Role::APP_ADMIN);
$acl->add('UserListController', '*', Role::APP_ADMIN);
diff --git a/app/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php
index 2d705217f..f44820d94 100644
--- a/app/ServiceProvider/RouteProvider.php
+++ b/app/ServiceProvider/RouteProvider.php
@@ -153,7 +153,7 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('user/:user_id/accounts', 'UserViewController', 'external');
$container['route']->addRoute('user/:user_id/integrations', 'UserViewController', 'integrations');
$container['route']->addRoute('user/:user_id/authentication', 'UserCredentialController', 'changeAuthentication');
- $container['route']->addRoute('user/:user_id/2fa', 'twofactor', 'index');
+ $container['route']->addRoute('user/:user_id/2fa', 'TwoFactorController', 'index');
$container['route']->addRoute('user/:user_id/avatar', 'AvatarFile', 'show');
// Groups
diff --git a/app/Template/twofactor/check.php b/app/Template/twofactor/check.php
index b0cb48251..06801d50a 100644
--- a/app/Template/twofactor/check.php
+++ b/app/Template/twofactor/check.php
@@ -1,4 +1,4 @@
-
\ No newline at end of file
+
diff --git a/app/Template/twofactor/disable.php b/app/Template/twofactor/disable.php
index bdbe12339..bc4191811 100644
--- a/app/Template/twofactor/disable.php
+++ b/app/Template/twofactor/disable.php
@@ -8,7 +8,7 @@
- = $this->url->link(t('Yes'), 'twofactor', 'disable', array('user_id' => $user['id'], 'disable' => 'yes'), true, 'btn btn-red') ?>
+ = $this->url->link(t('Yes'), 'TwoFactorController', 'disable', array('user_id' => $user['id'], 'disable' => 'yes'), true, 'btn btn-red') ?>
= t('or') ?> = $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
diff --git a/app/Template/twofactor/index.php b/app/Template/twofactor/index.php
index 6de365146..1ed414ed6 100644
--- a/app/Template/twofactor/index.php
+++ b/app/Template/twofactor/index.php
@@ -2,7 +2,7 @@
= t('Two factor authentication') ?>
-