From: Bart Visscher Date: Sun, 25 Sep 2011 21:33:22 +0000 (+0200) Subject: Move lostpassword code to own app X-Git-Tag: v3.0~101^2~22^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=950d4e1da498b7c928b5f6e1cbcca8e57ddecb0c;p=nextcloud-server.git Move lostpassword code to own app --- diff --git a/core/templates/login.php b/core/templates/login.php index 717f6bcabda..c8a86d71a91 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -1,7 +1,7 @@
- t('Lost your password?'); ?> + t('Lost your password?'); ?> diff --git a/core/templates/lostpassword.php b/core/templates/lostpassword.php deleted file mode 100644 index 67e34164d08..00000000000 --- a/core/templates/lostpassword.php +++ /dev/null @@ -1,14 +0,0 @@ - -
- t('You will receive a link to reset your password via Email.'); ?> - - t('Requested'); ?> - - - t('Login failed!'); ?> - - - - -
- \ No newline at end of file diff --git a/core/templates/resetpassword.php b/core/templates/resetpassword.php deleted file mode 100644 index 2f43a93cfb5..00000000000 --- a/core/templates/resetpassword.php +++ /dev/null @@ -1,10 +0,0 @@ -
-
- - t('Your password was reset'); ?> - - - - -
-
diff --git a/index.php b/index.php index bb1e370d241..0db8ad126ce 100644 --- a/index.php +++ b/index.php @@ -87,38 +87,6 @@ elseif(isset($_POST["user"]) && isset($_POST['password'])) { } } -// 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)); - } -} - // For all others cases, we display the guest page : else { OC_App::loadApps(); diff --git a/lostpassword/index.php b/lostpassword/index.php new file mode 100644 index 00000000000..0c078343a8d --- /dev/null +++ b/lostpassword/index.php @@ -0,0 +1,25 @@ + false, 'requested' => true)); + } else { + OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => true, 'requested' => false)); + } +} else { + OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => false, 'requested' => false)); +} diff --git a/lostpassword/resetpassword.php b/lostpassword/resetpassword.php new file mode 100644 index 00000000000..1a6a74e5ff4 --- /dev/null +++ b/lostpassword/resetpassword.php @@ -0,0 +1,27 @@ + true)); + } else { + OC_Template::printGuestPage('lostpassword', 'resetpassword', array('success' => false)); + } + } else { + OC_Template::printGuestPage('lostpassword', 'resetpassword', array('success' => false)); + } +} else { + // Someone lost their password + OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => false, 'requested' => false)); +} diff --git a/lostpassword/templates/lostpassword.php b/lostpassword/templates/lostpassword.php new file mode 100644 index 00000000000..1c95e0be499 --- /dev/null +++ b/lostpassword/templates/lostpassword.php @@ -0,0 +1,14 @@ +
+
+ t('You will receive a link to reset your password via Email.'); ?> + + t('Requested'); ?> + + + t('Login failed!'); ?> + + + + +
+
diff --git a/lostpassword/templates/resetpassword.php b/lostpassword/templates/resetpassword.php new file mode 100644 index 00000000000..888d98e8bdc --- /dev/null +++ b/lostpassword/templates/resetpassword.php @@ -0,0 +1,10 @@ +
+
+ + t('Your password was reset'); ?> + + + + +
+