set selected language for otp form

This commit is contained in:
Daniel Seifert 2022-11-24 20:27:07 +01:00
parent 77eca02079
commit a809c04b5b
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
4 changed files with 12 additions and 18 deletions

View File

@ -90,6 +90,10 @@ class d3totpadminlogin extends AdminController
$this->addTplParam('selectedProfile', Registry::getRequest()->getRequestEscapedParameter('profile'));
$this->addTplParam('selectedChLanguage', Registry::getRequest()->getRequestEscapedParameter('chlanguage'));
/** @var d3_totp_LoginController $loginController */
$loginController = oxNew(LoginController::class);
$loginController->d3totpAfterLoginSetLanguage();
return parent::render();
}

View File

@ -28,13 +28,8 @@ class d3totplogin extends FrontendController
public function render()
{
if (false == Registry::getSession()->hasVariable(d3totp_conf::SESSION_CURRENTUSER)) {
if (!Registry::getSession()->hasVariable(d3totp_conf::SESSION_CURRENTUSER)) {
$this->getUtils()->redirect('index.php?cl=start');
if (false == defined('OXID_PHP_UNIT')) {
// @codeCoverageIgnoreStart
exit;
// @codeCoverageIgnoreEnd
}
}
$this->addTplParam('navFormParams', Registry::getSession()->getVariable(d3totp_conf::SESSION_NAVFORMPARAMS));

View File

@ -82,7 +82,13 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
$myUtilsServer->setOxCookie("oxidadminprofile", "", time() - 3600, "/");
}
// languages
$this->d3totpAfterLoginSetLanguage();
Registry::getSession()->deleteVariable(d3totp_conf::SESSION_ADMIN_CHLANGUAGE);
}
public function d3totpAfterLoginSetLanguage()
{
$myUtilsServer = Registry::getUtilsServer();
$iLang = Registry::getSession()->getVariable(d3totp_conf::SESSION_ADMIN_CHLANGUAGE);
$aLanguages = Registry::getLang()->getAdminTplLanguageArray();
@ -92,7 +98,6 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
$myUtilsServer->setOxCookie("oxidadminlanguage", $aLanguages[$iLang]->abbr, time() + 31536000, "/");
Registry::getLang()->setTplLanguage($iLang);
Registry::getSession()->deleteVariable(d3totp_conf::SESSION_ADMIN_CHLANGUAGE);
}
/**

View File

@ -47,21 +47,11 @@ class d3_totp_utils extends d3_totp_utils_parent
&& $totp->isActive() === false
) {
$this->redirect('index.php?cl=d3force_2fa');
if (false == defined('OXID_PHP_UNIT')) {
// @codeCoverageIgnoreStart
exit;
// @codeCoverageIgnoreEnd
}
}
//staten der prüfung vom einmalpasswort
if ($blAuth && $totp->isActive() && false === $totpAuth) {
$this->redirect('index.php?cl=d3totpadminlogin');
if (false == defined('OXID_PHP_UNIT')) {
// @codeCoverageIgnoreStart
exit;
// @codeCoverageIgnoreEnd
}
}
return $blAuth;