summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-26 21:05:54 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-26 21:05:54 -0400
commit33dea152fc6b0c061b1f61060cc75710dd0ec236 (patch)
treedd40e7501f42703957244171b89905b9050fe1d0
parentd9101da79e839984e0e782b48113dc61157d6688 (diff)
Rename 2FA controller
-rw-r--r--app/Controller/TwoFactorController.php (renamed from app/Controller/Twofactor.php)12
-rw-r--r--app/Middleware/PostAuthenticationMiddleware.php4
-rw-r--r--app/ServiceProvider/AuthenticationProvider.php2
-rw-r--r--app/ServiceProvider/RouteProvider.php2
-rw-r--r--app/Template/twofactor/check.php4
-rw-r--r--app/Template/twofactor/disable.php2
-rw-r--r--app/Template/twofactor/index.php2
-rw-r--r--app/Template/twofactor/show.php4
-rw-r--r--app/Template/user_view/sidebar.php10
9 files changed, 21 insertions, 21 deletions
diff --git a/app/Controller/Twofactor.php b/app/Controller/TwoFactorController.php
index 118613b2..c8540f85 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 c1237f47..650d47aa 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 051dcc30..3b5a9bab 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 2d705217..f44820d9 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 b0cb4825..06801d50 100644
--- a/app/Template/twofactor/check.php
+++ b/app/Template/twofactor/check.php
@@ -1,4 +1,4 @@
-<form method="post" action="<?= $this->url->href('twofactor', 'check', array('user_id' => $this->user->getId())) ?>" autocomplete="off">
+<form method="post" action="<?= $this->url->href('TwoFactorController', 'check', array('user_id' => $this->user->getId())) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->label(t('Code'), 'code') ?>
@@ -7,4 +7,4 @@
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Check my code') ?></button>
</div>
-</form> \ No newline at end of file
+</form>
diff --git a/app/Template/twofactor/disable.php b/app/Template/twofactor/disable.php
index bdbe1233..bc419181 100644
--- a/app/Template/twofactor/disable.php
+++ b/app/Template/twofactor/disable.php
@@ -8,7 +8,7 @@
</p>
<div class="form-actions">
- <?= $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'])) ?>
</div>
</div>
diff --git a/app/Template/twofactor/index.php b/app/Template/twofactor/index.php
index 6de36514..1ed414ed 100644
--- a/app/Template/twofactor/index.php
+++ b/app/Template/twofactor/index.php
@@ -2,7 +2,7 @@
<h2><?= t('Two factor authentication') ?></h2>
</div>
-<form method="post" action="<?= $this->url->href('twofactor', $user['twofactor_activated'] == 1 ? 'deactivate' : 'show', array('user_id' => $user['id'])) ?>" autocomplete="off">
+<form method="post" action="<?= $this->url->href('TwoFactorController', $user['twofactor_activated'] == 1 ? 'deactivate' : 'show', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<p><?= t('Two-Factor Provider: ') ?><strong><?= $this->text->e($provider) ?></strong></p>
<div class="form-actions">
diff --git a/app/Template/twofactor/show.php b/app/Template/twofactor/show.php
index 59897e20..0aeef427 100644
--- a/app/Template/twofactor/show.php
+++ b/app/Template/twofactor/show.php
@@ -19,7 +19,7 @@
<?php endif ?>
<h3><?= t('Test your device') ?></h3>
-<form method="post" action="<?= $this->url->href('twofactor', 'test', array('user_id' => $user['id'])) ?>" autocomplete="off">
+<form method="post" action="<?= $this->url->href('TwoFactorController', 'test', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->label(t('Code'), 'code') ?>
@@ -28,4 +28,4 @@
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Check my code') ?></button>
</div>
-</form> \ No newline at end of file
+</form>
diff --git a/app/Template/user_view/sidebar.php b/app/Template/user_view/sidebar.php
index 5eb0457b..0f2f3569 100644
--- a/app/Template/user_view/sidebar.php
+++ b/app/Template/user_view/sidebar.php
@@ -49,12 +49,12 @@
<?php endif ?>
<?php if ($this->user->isCurrentUser($user['id'])): ?>
- <li <?= $this->app->checkMenuSelection('twofactor', 'index') ?>>
- <?= $this->url->link(t('Two factor authentication'), 'twofactor', 'index', array('user_id' => $user['id'])) ?>
+ <li <?= $this->app->checkMenuSelection('TwoFactorController', 'index') ?>>
+ <?= $this->url->link(t('Two factor authentication'), 'TwoFactorController', 'index', array('user_id' => $user['id'])) ?>
</li>
- <?php elseif ($this->user->hasAccess('twofactor', 'disable') && $user['twofactor_activated'] == 1): ?>
- <li <?= $this->app->checkMenuSelection('twofactor', 'disable') ?>>
- <?= $this->url->link(t('Two factor authentication'), 'twofactor', 'disable', array('user_id' => $user['id'])) ?>
+ <?php elseif ($this->user->hasAccess('TwoFactorController', 'disable') && $user['twofactor_activated'] == 1): ?>
+ <li <?= $this->app->checkMenuSelection('TwoFactorController', 'disable') ?>>
+ <?= $this->url->link(t('Two factor authentication'), 'TwoFactorController', 'disable', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>