diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-09-30 23:48:20 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-09-30 23:48:20 +0200 |
commit | 21a88613a150c550e32d63df9a9ef8bf3d5107d0 (patch) | |
tree | 45e76fbae9349265489dbebe5aef090f45e49a85 /index.php | |
parent | ddd28aae67d7e67b7e39c1fe58fe52659d1dd755 (diff) | |
parent | 5fbf378d1021da91977caa6c7df9944c353d4786 (diff) | |
download | nextcloud-server-21a88613a150c550e32d63df9a9ef8bf3d5107d0.tar.gz nextcloud-server-21a88613a150c550e32d63df9a9ef8bf3d5107d0.zip |
Merge branch 'lostpassword'
Conflicts:
core/templates/login.php
index.php
lib/util.php
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/index.php b/index.php index 68754fcc567..17429b97476 100644 --- a/index.php +++ b/index.php @@ -63,7 +63,7 @@ elseif(isset($_COOKIE["oc_remember_login"]) && isset($_COOKIE["oc_token"]) && is OC_Util::redirectToDefaultPage(); } else { - OC_Template::printGuestPage("", "login", array("error" => true, 'username' => isset($_COOKIE['oc_username'])?$_COOKIE['oc_username']:'' )); + OC_Util::displayLoginPage(array('error' => true)); } } @@ -82,46 +82,14 @@ elseif(isset($_POST["user"]) && isset($_POST['password'])) { } OC_Util::redirectToDefaultPage(); } else { - OC_Template::printGuestPage('', 'login', array('error' => true, 'username' => isset($_COOKIE['oc_username'])?$_COOKIE['oc_username']:'' )); - } -} - -// Someone lost their password: -elseif(isset($_GET['lostpassword'])) { - OC_App::loadApps(); - if (isset($_POST['user'])) { - if (OC_User::userExists($_POST['user'])) { - $token = sha1($_POST['user']+uniqId()); - OC_Preferences::setValue($_POST['user'], "owncloud", "lostpassword", $token); - // TODO send email with link+token - OC_Template::printGuestPage("", "lostpassword", array("error" => false, "requested" => true)); - } else { - OC_Template::printGuestPage("", "lostpassword", array("error" => true, "requested" => false)); - } - } else { - OC_Template::printGuestPage("", "lostpassword", array("error" => false, "requested" => false)); - } -} - -// Someone wants to reset their password: -elseif(isset($_GET['resetpassword']) && isset($_GET['token']) && isset($_GET['user']) && OC_Preferences::getValue($_GET['user'], "owncloud", "lostpassword") === $_GET['token']) { - OC_App::loadApps(); - if (isset($_POST['password'])) { - if (OC_User::setPassword($_GET['user'], $_POST['password'])) { - OC_Preferences::deleteKey($_GET['user'], "owncloud", "lostpassword"); - OC_Template::printGuestPage("", "resetpassword", array("success" => true)); - } else { - OC_Template::printGuestPage("", "resetpassword", array("success" => false)); - } - } else { - OC_Template::printGuestPage("", "resetpassword", array("success" => false)); + OC_Util::displayLoginPage(array('error' => true)); } } // For all others cases, we display the guest page : else { OC_App::loadApps(); - OC_Template::printGuestPage('', 'login', array('error' => false, 'username' => isset($_COOKIE['oc_username'])?$_COOKIE['oc_username']:'' )); + OC_Util::displayLoginPage(array('error' => false)); } -?>
\ No newline at end of file +?> |