From 9e0b92c9a9b19497402e96b521da5786828a9062 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Thu, 24 Nov 2022 09:10:45 +0100 Subject: [PATCH] transfer profile and language selection through webauthn process --- .../Controller/Admin/d3webauthnadminlogin.php | 9 +++++---- src/Application/views/admin/tpl/d3webauthnlogin.tpl | 2 ++ .../Controller/Admin/d3_LoginController_Webauthn.php | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Application/Controller/Admin/d3webauthnadminlogin.php b/src/Application/Controller/Admin/d3webauthnadminlogin.php index 900912a..17136b1 100755 --- a/src/Application/Controller/Admin/d3webauthnadminlogin.php +++ b/src/Application/Controller/Admin/d3webauthnadminlogin.php @@ -75,6 +75,10 @@ class d3webauthnadminlogin extends AdminController $this->generateCredentialRequest(); $this->addTplParam('navFormParams', $this->d3GetSession()->getVariable(WebauthnConf::WEBAUTHN_SESSION_NAVFORMPARAMS)); + $this->addTplParam('currentProfile', $this->d3GetSession()->getVariable(WebauthnConf::WEBAUTHN_ADMIN_PROFILE)); + $this->d3GetSession()->deleteVariable(WebauthnConf::WEBAUTHN_ADMIN_PROFILE); + $this->addTplParam('currentChLanguage', $this->d3GetSession()->getVariable(WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE)); + $this->d3GetSession()->deleteVariable(WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE); return $this->d3CallMockableParent('render'); } @@ -114,7 +118,7 @@ class d3webauthnadminlogin extends AdminController /** @var d3_User_Webauthn $user */ $user = $this->d3GetUserObject(); $userId = $this->d3GetSession()->getVariable(WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER); - $selectedProfile = $this->d3GetSession()->getVariable(WebauthnConf::WEBAUTHN_ADMIN_PROFILE); + $selectedProfile = Registry::getRequest()->getRequestEscapedParameter('profile'); try { $error = Registry::getRequest()->getRequestEscapedParameter('error'); @@ -132,12 +136,9 @@ class d3webauthnadminlogin extends AdminController $user->load($userId); $session = $this->d3GetSession(); $adminProfiles = $session->getVariable("aAdminProfiles"); - $selectedLanguage = $session->getVariable(WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE); $session->initNewSession(); $session->setVariable("aAdminProfiles", $adminProfiles); $session->setVariable(WebauthnConf::OXID_ADMIN_AUTH, $userId); - $session->setVariable(WebauthnConf::WEBAUTHN_ADMIN_PROFILE, $selectedProfile); - $session->setVariable(WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE, $selectedLanguage); $cookie = Registry::getUtilsServer()->getOxCookie(); if ($cookie === null) { diff --git a/src/Application/views/admin/tpl/d3webauthnlogin.tpl b/src/Application/views/admin/tpl/d3webauthnlogin.tpl index b480f53..8778948 100644 --- a/src/Application/views/admin/tpl/d3webauthnlogin.tpl +++ b/src/Application/views/admin/tpl/d3webauthnlogin.tpl @@ -23,6 +23,8 @@ + + [{if !empty($Errors.default)}] [{include file="inc_error.tpl" Errorlist=$Errors.default}] diff --git a/src/Modules/Application/Controller/Admin/d3_LoginController_Webauthn.php b/src/Modules/Application/Controller/Admin/d3_LoginController_Webauthn.php index 9617b94..e9d5eb7 100755 --- a/src/Modules/Application/Controller/Admin/d3_LoginController_Webauthn.php +++ b/src/Modules/Application/Controller/Admin/d3_LoginController_Webauthn.php @@ -93,7 +93,7 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent public function d3webauthnAfterLogin() { $myUtilsServer = Registry::getUtilsServer(); - $sProfile = Registry::getSession()->getVariable(WebauthnConf::WEBAUTHN_ADMIN_PROFILE); + $sProfile = Registry::getRequest()->getRequestEscapedParameter('profile'); // #533 if (isset($sProfile)) { @@ -110,7 +110,7 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent } // languages - $iLang = Registry::getSession()->getVariable(WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE); + $iLang = Registry::getRequest()->getRequestEscapedParameter('chlanguage'); $aLanguages = Registry::getLang()->getAdminTplLanguageArray(); if (!isset($aLanguages[$iLang])) {