Use the router for prefs_twofactor.php
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
bf975c68fd
commit
1de76c66dd
@ -129,6 +129,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
|
||||
$routes->addRoute(['GET', 'POST'], '/manage', function () {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/preferences/manage.php';
|
||||
});
|
||||
$routes->addRoute(['GET', 'POST'], '/twofactor', function () {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/preferences/twofactor.php';
|
||||
});
|
||||
});
|
||||
$routes->addGroup('/server', function (RouteCollector $routes) {
|
||||
$routes->addRoute(['GET', 'POST'], '/binlog', function () {
|
||||
|
||||
@ -631,12 +631,11 @@ class Menu
|
||||
$tabs['settings']['icon'] = 'b_tblops';
|
||||
$tabs['settings']['link'] = Url::getFromRoute('/preferences/manage');
|
||||
$tabs['settings']['text'] = __('Settings');
|
||||
$tabs['settings']['active'] = in_array(basename($GLOBALS['PMA_PHP_SELF']), [
|
||||
'prefs_twofactor.php',
|
||||
]) || (isset($_REQUEST['route']) && in_array($_REQUEST['route'], [
|
||||
$tabs['settings']['active'] = isset($_REQUEST['route']) && in_array($_REQUEST['route'], [
|
||||
'/preferences/forms',
|
||||
'/preferences/manage',
|
||||
]));
|
||||
'/preferences/twofactor',
|
||||
]);
|
||||
|
||||
if (! empty($binary_logs)) {
|
||||
$tabs['binlog']['icon'] = 's_tbl';
|
||||
|
||||
@ -62,7 +62,7 @@ class UserPreferencesHeader
|
||||
/* Second authentication factor */
|
||||
$content .= Util::getHtmlTab(
|
||||
[
|
||||
'link' => 'prefs_twofactor.php',
|
||||
'link' => 'index.php?route=/preferences/twofactor',
|
||||
'text' => __('Two-factor authentication'),
|
||||
]
|
||||
) . "\n";
|
||||
|
||||
@ -13,17 +13,12 @@ use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\TwoFactor;
|
||||
use PhpMyAdmin\UserPreferencesHeader;
|
||||
|
||||
if (! defined('ROOT_PATH')) {
|
||||
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $containerBuilder;
|
||||
|
||||
/**
|
||||
* Gets some core libraries and displays a top message if required
|
||||
*/
|
||||
require_once ROOT_PATH . 'libraries/common.inc.php';
|
||||
|
||||
/** @var Template $template */
|
||||
$template = $containerBuilder->get('template');
|
||||
/** @var Relation $relation */
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="group">
|
||||
<h2>{% trans "Configure two-factor authentication" %}</h2>
|
||||
<div class="group-cnt">
|
||||
<form method="POST" action="prefs_twofactor.php">
|
||||
<form method="post" action="{{ url('/preferences/twofactor') }}">
|
||||
{{ get_hidden_inputs() }}
|
||||
<input type="hidden" name="2fa_configure" value="{{ configure }}">
|
||||
{{ form|raw }}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="group">
|
||||
<h2>{% trans "Confirm disabling two-factor authentication" %}</h2>
|
||||
<div class="group-cnt">
|
||||
<form method="POST" action="prefs_twofactor.php">
|
||||
<form method="post" action="{{ url('/preferences/twofactor') }}">
|
||||
{{ "By disabling two factor authentication you will be again able to login using password only."|trans|notice }}
|
||||
{{ get_hidden_inputs() }}
|
||||
{{ form|raw }}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
<div class="group-cnt">
|
||||
<p>{% trans "You have enabled two factor authentication." %}</p>
|
||||
<p>{{ backend_description }}</p>
|
||||
<form method="post" action="prefs_twofactor.php">
|
||||
<form method="post" action="{{ url('/preferences/twofactor') }}">
|
||||
{{ get_hidden_inputs() }}
|
||||
<input class="btn btn-secondary" type="submit" name="2fa_remove" value="
|
||||
{%- trans "Disable two-factor authentication" %}">
|
||||
@ -43,7 +43,7 @@
|
||||
<div class="group row">
|
||||
<h2>{% trans "Configure two-factor authentication" %}</h2>
|
||||
<div class="group-cnt">
|
||||
<form method="post" action="prefs_twofactor.php">
|
||||
<form method="post" action="{{ url('/preferences/twofactor') }}">
|
||||
{{ get_hidden_inputs() }}
|
||||
{% for backend in backends %}
|
||||
<label class="displayblock">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user