set selected language for webauthn form

This commit is contained in:
Daniel Seifert 2022-11-24 20:37:02 +01:00
parent 9e0b92c9a9
commit a80d5dcde5
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
3 changed files with 15 additions and 7 deletions

View File

@ -65,13 +65,12 @@ class d3webauthnadminlogin extends AdminController
!$this->d3GetSession()->hasVariable(WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER)
) {
$this->getUtils()->redirect('index.php?cl=admin_start');
if (!defined('OXID_PHP_UNIT')) {
// @codeCoverageIgnoreStart
exit;
// @codeCoverageIgnoreEnd
}
}
/** @var d3_LoginController_Webauthn $loginController */
$loginController = oxNew(LoginController::class);
$loginController->d3WebauthnAfterLoginChangeLanguage();
$this->generateCredentialRequest();
$this->addTplParam('navFormParams', $this->d3GetSession()->getVariable(WebauthnConf::WEBAUTHN_SESSION_NAVFORMPARAMS));

View File

@ -21,4 +21,6 @@
<input type="hidden" name="fnc" value="d3AssertAuthn">
<input type="hidden" name="credential" value=''>
<input type="hidden" name="error" value=''>
<input type="hidden" name="profile" value="[{$currentProfile}]">
<input type="hidden" name="chlanguage" value="[{$currentChLanguage}]">
</form>

View File

@ -109,8 +109,16 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent
$myUtilsServer->setOxCookie("oxidadminprofile", "", time() - 3600, "/");
}
$this->d3WebauthnAfterLoginChangeLanguage();
Registry::getSession()->deleteVariable(WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE);
}
public function d3WebauthnAfterLoginChangeLanguage()
{
$myUtilsServer = Registry::getUtilsServer();
// languages
$iLang = Registry::getRequest()->getRequestEscapedParameter('chlanguage');
$iLang = Registry::getRequest()->getRequestEscapedParameter('chlanguage') ?:
Registry::getSession()->getVariable(WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE);
$aLanguages = Registry::getLang()->getAdminTplLanguageArray();
if (!isset($aLanguages[$iLang])) {
@ -119,7 +127,6 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent
$myUtilsServer->setOxCookie("oxidadminlanguage", $aLanguages[$iLang]->abbr, time() + 31536000, "/");
Registry::getLang()->setTplLanguage($iLang);
Registry::getSession()->deleteVariable(WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE);
}
/**