diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-10-03 20:41:52 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-10-03 20:44:01 +0200 |
commit | e8c6252a4ce1151b11f1faa8e602c06aae4294d8 (patch) | |
tree | 28975fd3648fd245a0cec9d7d5d3c9c838108202 /core/lostpassword/index.php | |
parent | dec810666538a94c1af69c4a54cd8ed5cc067579 (diff) | |
download | nextcloud-server-e8c6252a4ce1151b11f1faa8e602c06aae4294d8.tar.gz nextcloud-server-e8c6252a4ce1151b11f1faa8e602c06aae4294d8.zip |
Move lostpassword to core dir
Diffstat (limited to 'core/lostpassword/index.php')
-rw-r--r-- | core/lostpassword/index.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php new file mode 100644 index 00000000000..de0d393ec78 --- /dev/null +++ b/core/lostpassword/index.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright (c) 2010 Frank Karlitschek karlitschek@kde.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 = sha1($_POST['user']+uniqId()); + OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token); + $email = OC_Preferences::getValue($_POST['user'], 'lostpassword', 'email', ''); + if (!empty($email)) { + $link = OC_Helper::linkTo('core/lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token; + $tmpl = new OC_Template('core/lostpassword', 'email'); + $tmpl->assign('link', $link); + $msg = $tmpl->fetchPage(); + $l = new OC_L10N('core'); + mail($email, $l->t('Owncloud password reset'), $msg); + } + 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)); +} |