summaryrefslogtreecommitdiffstats
path: root/core/lostpassword/index.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-10-17 17:24:49 +0200
committerBart Visscher <bartv@thisnet.nl>2012-10-17 17:24:49 +0200
commit0a614429af21193f1da47c94d1382953b8d6ba8c (patch)
treeda51192bde73e83f620fc4259d5580bf27b58a52 /core/lostpassword/index.php
parent6081bfa2bcbe121e373486273ecce58a49e6fa97 (diff)
downloadnextcloud-server-0a614429af21193f1da47c94d1382953b8d6ba8c.tar.gz
nextcloud-server-0a614429af21193f1da47c94d1382953b8d6ba8c.zip
Change the lostpassword flow to a controller
Diffstat (limited to 'core/lostpassword/index.php')
-rw-r--r--core/lostpassword/index.php35
1 files changed, 0 insertions, 35 deletions
diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php
deleted file mode 100644
index 906208dcbc4..00000000000
--- a/core/lostpassword/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Frank Karlitschek frank@owncloud.org
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
-*/
-
-$RUNTIME_NOAPPS = TRUE; //no apps
-require_once '../../lib/base.php';
-
-
-// Someone lost their password:
-if (isset($_POST['user'])) {
- if (OC_User::userExists($_POST['user'])) {
- $token = hash("sha256", OC_Util::generate_random_bytes(30).OC_Config::getValue('passwordsalt', ''));
- OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash("sha256", $token)); // Hash the token again to prevent timing attacks
- $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
- if (!empty($email)) {
- $link = OC_Helper::linkToAbsolute('core/lostpassword', 'resetpassword.php', array('user' => $_POST['user'], 'token' => $token));
- $tmpl = new OC_Template('core/lostpassword', 'email');
- $tmpl->assign('link', $link, false);
- $msg = $tmpl->fetchPage();
- $l = OC_L10N::get('core');
- $from = 'lostpassword-noreply@' . OCP\Util::getServerHost();
- OC_MAIL::send($email, $_POST['user'], $l->t('ownCloud password reset'), $msg, $from, 'ownCloud');
- echo('sent');
- }
- OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => true));
- } else {
- OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => true, 'requested' => false));
- }
-} else {
- OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => false));
-}