diff options
author | Bartek Przybylski <bart.p.pl@gmail.com> | 2011-09-18 09:15:30 +0200 |
---|---|---|
committer | Bartek Przybylski <bart.p.pl@gmail.com> | 2011-09-18 09:15:30 +0200 |
commit | 68e7666293f65670242c76f8fa269c88f7fdc267 (patch) | |
tree | fb6bff91e67092c51ed3b921525a7ef5db348327 /index.php | |
parent | 8c7aa060884fb3eaa1fe39412eb7622b743478b4 (diff) | |
download | nextcloud-server-68e7666293f65670242c76f8fa269c88f7fdc267.tar.gz nextcloud-server-68e7666293f65670242c76f8fa269c88f7fdc267.zip |
Changed behaviour of remember checkbox
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/index.php b/index.php index 52a00465f22..3c8a0e3bed6 100644 --- a/index.php +++ b/index.php @@ -59,13 +59,37 @@ elseif(OC_User::isLoggedIn()) { } } +// Semeone set remember login when login +elseif(isset($_COOKIE["oc_remember_login"]) && $_COOKIE["oc_remember_login"]) { + OC_App::loadApps(); + error_log("Trying to login from cookie"); + if(OC_User::login($_COOKIE["oc_username"], $_COOKIE["oc_password"])) { + header("Location: ". $WEBROOT.'/'.OC_Appconfig::getValue("core", "defaultpage", "files/index.php")); + if(!empty($_POST["remember_login"])){ + OC_User::setUsernameInCookie($_POST["user"], $_POST["password"]); + } + else { + OC_User::unsetUsernameInCookie(); + } + exit(); + } + else { + if(isset($_COOKIE["username"])){ + OC_Template::printGuestPage("", "login", array("error" => true, "username" => $_COOKIE["username"])); + }else{ + OC_Template::printGuestPage("", "login", array("error" => true)); + } + } +} + // Someone wants to log in : elseif(isset($_POST["user"]) && isset($_POST['password'])) { OC_App::loadApps(); if(OC_User::login($_POST["user"], $_POST["password"])) { header("Location: ".$WEBROOT.'/'.OC_Appconfig::getValue("core", "defaultpage", "files/index.php")); if(!empty($_POST["remember_login"])){ - OC_User::setUsernameInCookie($_POST["user"]); + error_log("Setting remember login to cookie"); + OC_User::setUsernameInCookie($_POST["user"], $_POST["password"]); } else { OC_User::unsetUsernameInCookie(); @@ -73,8 +97,8 @@ elseif(isset($_POST["user"]) && isset($_POST['password'])) { exit(); } else { - if(isset($_COOKIE["username"])){ - OC_Template::printGuestPage("", "login", array("error" => true, "username" => $_COOKIE["username"])); + if(isset($_COOKIE["oc_username"])){ + OC_Template::printGuestPage("", "login", array("error" => true, "username" => $_COOKIE["oc_username"])); }else{ OC_Template::printGuestPage("", "login", array("error" => true)); } |