From: Michael M Slusarz Date: Mon, 20 Dec 2010 17:18:17 +0000 (-0700) Subject: Fix language change on login screen X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3bd8a189d4915f068ce33579202f253b31725e6f;p=horde.git Fix language change on login screen --- diff --git a/horde/login.php b/horde/login.php index 1fa2918c4..267deb3e4 100644 --- a/horde/login.php +++ b/horde/login.php @@ -70,33 +70,6 @@ if (!$is_auth) { /* Get an Auth object. */ $auth = $injector->getInstance('Horde_Core_Factory_Auth')->create(($is_auth && $vars->app) ? $vars->app : null); -/* Build the list of necessary login parameters. */ -$loginparams = array( - 'horde_user' => array( - 'label' => _("Username"), - 'type' => 'text', - 'value' => $vars->horde_user - ), - 'horde_pass' => array( - 'label' => _("Password"), - 'type' => 'password' - ) -); -$js_code = array( - 'HordeLogin.user_error' => _("Please enter a username."), - 'HordeLogin.pass_error' => _("Please enter a password.") -); -$js_files = array( - array('login.js', 'horde') -); - -try { - $result = $auth->getLoginParams(); - $loginparams = array_filter(array_merge($loginparams, $result['params'])); - $js_code = array_merge($js_code, $result['js_code']); - $js_files = array_merge($js_files, $result['js_files']); -} catch (Horde_Exception $e) {} - /* Get URL/Anchor strings now. */ if ($vars->url) { $url_in = new Horde_Url($vars->url); @@ -161,9 +134,13 @@ if ($logout_reason) { $auth_params = array( 'password' => Horde_Util::getPost('horde_pass') ); - foreach (array_diff(array_keys($loginparams), array('horde_user', 'horde_pass')) as $val) { - $auth_params[$val] = Horde_Util::getPost($val); - } + + try { + $result = $auth->getLoginParams(); + foreach ($result['params'] as $val) { + $auth_params[$val] = Horde_Util::getPost($val); + } + } catch (Horde_Exception $e) {} if ($vars->ie_version) { $browser->setIEVersion($vars->ie_version); @@ -201,13 +178,38 @@ if ($logout_reason) { $entry = sprintf('FAILED LOGIN for %s [%s] to Horde', $vars->horde_user, $_SERVER['REMOTE_ADDR']); Horde::logMessage($entry, 'ERR'); -} else { - $new_lang = Horde_Util::getGet('new_lang'); - if ($new_lang) { - $registry->setLanguageEnvironment($new_lang); - } +} elseif ($new_lang = Horde_Util::getGet('new_lang')) { + $registry->setLanguageEnvironment($new_lang); } +/* Build the list of necessary login parameters. + * Need to wait until after we set language to get login parameters. */ +$loginparams = array( + 'horde_user' => array( + 'label' => _("Username"), + 'type' => 'text', + 'value' => $vars->horde_user + ), + 'horde_pass' => array( + 'label' => _("Password"), + 'type' => 'password' + ) +); +$js_code = array( + 'HordeLogin.user_error' => _("Please enter a username."), + 'HordeLogin.pass_error' => _("Please enter a password.") +); +$js_files = array( + array('login.js', 'horde') +); + +try { + $result = $auth->getLoginParams(); + $loginparams = array_filter(array_merge($loginparams, $result['params'])); + $js_code = array_merge($js_code, $result['js_code']); + $js_files = array_merge($js_files, $result['js_files']); +} catch (Horde_Exception $e) {} + /* If we currently are authenticated, and are not trying to authenticate to * an application, redirect to initial page. This is done in index.php. * If we are trying to authenticate to an application, but don't have to,