Rename 2FA controller
This commit is contained in:
parent
d9101da79e
commit
33dea152fc
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -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 ?>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue