aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorBartek Przybylski <bart.p.pl@gmail.com>2011-09-18 09:15:30 +0200
committerBartek Przybylski <bart.p.pl@gmail.com>2011-09-18 09:15:30 +0200
commit68e7666293f65670242c76f8fa269c88f7fdc267 (patch)
treefb6bff91e67092c51ed3b921525a7ef5db348327 /index.php
parent8c7aa060884fb3eaa1fe39412eb7622b743478b4 (diff)
downloadnextcloud-server-68e7666293f65670242c76f8fa269c88f7fdc267.tar.gz
nextcloud-server-68e7666293f65670242c76f8fa269c88f7fdc267.zip
Changed behaviour of remember checkbox
Diffstat (limited to 'index.php')
-rw-r--r--index.php30
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));
}