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 @@