Move display of login page to function in OC_Util
This commit is contained in:
parent
e4dc33b368
commit
aae6881494
14
index.php
14
index.php
|
@ -63,7 +63,7 @@ elseif(isset($_COOKIE["oc_remember_login"]) && $_COOKIE["oc_remember_login"]) {
|
|||
OC_Util::redirectToDefaultPage();
|
||||
}
|
||||
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();
|
||||
}
|
||||
else {
|
||||
if(isset($_COOKIE["oc_username"])){
|
||||
OC_Template::printGuestPage("", "login", array("error" => true, "username" => $_COOKIE["oc_username"]));
|
||||
}else{
|
||||
OC_Template::printGuestPage("", "login", array("error" => true));
|
||||
}
|
||||
OC_Util::displayLoginPage(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 :
|
||||
else {
|
||||
OC_App::loadApps();
|
||||
if(isset($_COOKIE["username"])){
|
||||
OC_Template::printGuestPage("", "login", array("error" => false, "username" => $_COOKIE["username"]));
|
||||
}else{
|
||||
OC_Template::printGuestPage("", "login", array("error" => false));
|
||||
}
|
||||
OC_Util::displayLoginPage(array('error' => false));
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -247,6 +247,13 @@ class OC_Util {
|
|||
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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue