From a80d5dcde5db4ee9aba216b3bd60ddab70df658f Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Thu, 24 Nov 2022 20:37:02 +0100 Subject: [PATCH] set selected language for webauthn form --- .../Controller/Admin/d3webauthnadminlogin.php | 9 ++++----- src/Application/views/tpl/inc/js_login.tpl | 2 ++ .../Controller/Admin/d3_LoginController_Webauthn.php | 11 +++++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Application/Controller/Admin/d3webauthnadminlogin.php b/src/Application/Controller/Admin/d3webauthnadminlogin.php index 17136b1..5233f5f 100755 --- a/src/Application/Controller/Admin/d3webauthnadminlogin.php +++ b/src/Application/Controller/Admin/d3webauthnadminlogin.php @@ -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)); diff --git a/src/Application/views/tpl/inc/js_login.tpl b/src/Application/views/tpl/inc/js_login.tpl index eed57f1..2597e54 100644 --- a/src/Application/views/tpl/inc/js_login.tpl +++ b/src/Application/views/tpl/inc/js_login.tpl @@ -21,4 +21,6 @@ + + diff --git a/src/Modules/Application/Controller/Admin/d3_LoginController_Webauthn.php b/src/Modules/Application/Controller/Admin/d3_LoginController_Webauthn.php index e9d5eb7..906bb85 100755 --- a/src/Modules/Application/Controller/Admin/d3_LoginController_Webauthn.php +++ b/src/Modules/Application/Controller/Admin/d3_LoginController_Webauthn.php @@ -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); } /**