Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain 2FA authorization #15749

Merged
merged 2 commits into from Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions prefs_forms.php
Expand Up @@ -14,6 +14,7 @@
use PhpMyAdmin\Relation;
use PhpMyAdmin\Response;
use PhpMyAdmin\Template;
use PhpMyAdmin\TwoFactor;
use PhpMyAdmin\Url;
use PhpMyAdmin\UserPreferences;
use PhpMyAdmin\UserPreferencesHeader;
Expand Down Expand Up @@ -59,8 +60,12 @@

$error = null;
if ($form_display->process(false) && ! $form_display->hasErrors()) {
// Load 2FA settings
$twoFactor = new TwoFactor($GLOBALS['cfg']['Server']['user']);
// save settings
$result = $userPreferences->save($cf->getConfigArray());
// save back the 2FA setting only
$twoFactor->save();
if ($result === true) {
// reload config
$GLOBALS['PMA_Config']->loadUserPreferences();
Expand Down
13 changes: 13 additions & 0 deletions test/classes/Plugins/Auth/AuthenticationCookieTest.php
Expand Up @@ -1018,6 +1018,19 @@ public function testCookieDecrypt()
'sec321'
)
);
$this->assertEquals(
victorphoenix3 marked this conversation as resolved.
Show resolved Hide resolved
'root',
$this->object->cookieDecrypt(
'{"iv":"AclJhCM7ryNiuPnw3Y8cXg==","mac":"d0ef75e852bc162e81496e116dc571182cb2cba6","payload":"O4vrt9R1xyzAw7ypvrLmQA=="}',
':Kb1?)c(r{]-{`HW*hOzuufloK(M~!p'
)
);
$this->assertFalse(
$this->object->cookieDecrypt(
'{"iv":"AclJhCM7ryNiuPnw3Y8cXg==","mac":"d0ef75e852bc162e81496e116dc571182cb2cba6","payload":"O4vrt9R1xyzAw7ypvrLmQA=="}',
'aedzoiefpzf,zf1z7ef6ef84'
)
);
}

/**
Expand Down