diff --git a/core/templates/login.php b/core/templates/login.php index b35c4a33be..2c9b766aa4 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -2,16 +2,16 @@
'; } ?> - + t('Lost your password?'); ?>

- autocomplete="on" required /> + autocomplete="on" required />

- /> + />

diff --git a/index.php b/index.php index 4ffd013aa8..86d268bf28 100755 --- a/index.php +++ b/index.php @@ -43,9 +43,6 @@ if (!OC::handleRequest()) { $error = true; } if(!array_key_exists('sectoken', $_SESSION) || (array_key_exists('sectoken', $_SESSION) && is_null(OC::$REQUESTEDFILE)) || substr(OC::$REQUESTEDFILE, -3) == 'php'){ - $sectoken=rand(1000000,9999999); - $_SESSION['sectoken']=$sectoken; - $redirect_url = (isset($_REQUEST['redirect_url'])) ? OC_Util::sanitizeHTML($_REQUEST['redirect_url']) : $_SERVER['REQUEST_URI']; - OC_Template::printGuestPage('', 'login', array('error' => $error, 'sectoken' => $sectoken, 'redirect' => $redirect_url)); + OC_Util::displayLoginPage($error); } } diff --git a/lib/util.php b/lib/util.php index 4c5d416f9f..732acbb920 100755 --- a/lib/util.php +++ b/lib/util.php @@ -271,15 +271,26 @@ class OC_Util { return $errors; } - public static function displayLoginPage($parameters = array()){ - if(isset($_COOKIE["username"])){ - $parameters["username"] = $_COOKIE["username"]; + public static function displayLoginPage($display_lostpassword) { + $parameters = array(); + $parameters['display_lostpassword'] = $display_lostpassword; + if (!empty($_POST['user'])) { + $parameters["username"] = + OC_Util::sanitizeHTML($_POST['user']).'"'; + $parameters['user_autofocus'] = false; } else { $parameters["username"] = ''; + $parameters['user_autofocus'] = true; } $sectoken=rand(1000000,9999999); $_SESSION['sectoken']=$sectoken; $parameters["sectoken"] = $sectoken; + if (isset($_REQUEST['redirect_url'])) { + $redirect_url = OC_Util::sanitizeHTML($_REQUEST['redirect_url']); + } else { + $redirect_url = $_SERVER['REQUEST_URI']; + } + $parameters['redirect_url'] = $redirect_url; OC_Template::printGuestPage("", "login", $parameters); }