Move display of login page to function in OC_Util

This commit is contained in:
Bart Visscher 2011-09-25 22:47:29 +02:00
parent e4dc33b368
commit aae6881494
2 changed files with 10 additions and 11 deletions

View File

@ -63,7 +63,7 @@ elseif(isset($_COOKIE["oc_remember_login"]) && $_COOKIE["oc_remember_login"]) {
OC_Util::redirectToDefaultPage(); OC_Util::redirectToDefaultPage();
} }
else { else {
OC_Template::printGuestPage("", "login", array("error" => true)); OC_Util::displayLoginPage(array('error' => true));
} }
} }
@ -83,11 +83,7 @@ elseif(isset($_POST["user"]) && isset($_POST['password'])) {
OC_Util::redirectToDefaultPage(); OC_Util::redirectToDefaultPage();
} }
else { else {
if(isset($_COOKIE["oc_username"])){ OC_Util::displayLoginPage(array('error' => true));
OC_Template::printGuestPage("", "login", array("error" => true, "username" => $_COOKIE["oc_username"]));
}else{
OC_Template::printGuestPage("", "login", array("error" => true));
}
} }
} }
@ -126,11 +122,7 @@ elseif(isset($_GET['resetpassword']) && isset($_GET['token']) && isset($_GET['us
// For all others cases, we display the guest page : // For all others cases, we display the guest page :
else { else {
OC_App::loadApps(); OC_App::loadApps();
if(isset($_COOKIE["username"])){ OC_Util::displayLoginPage(array('error' => false));
OC_Template::printGuestPage("", "login", array("error" => false, "username" => $_COOKIE["username"]));
}else{
OC_Template::printGuestPage("", "login", array("error" => false));
}
} }
?> ?>

View File

@ -247,6 +247,13 @@ class OC_Util {
return $errors; return $errors;
} }
public static function displayLoginPage($parameters = array()){
if(isset($_COOKIE["username"])){
$parameters["username"] = $_COOKIE["username"];
}
OC_Template::printGuestPage("", "login", $parameters);
}
/** /**
* Check if the user is logged in, redirects to home if not * Check if the user is logged in, redirects to home if not
*/ */