parent
aae6881494
commit
950d4e1da4
@ -0,0 +1,25 @@ |
||||
<?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); |
||||
// TODO send email with link+token |
||||
$link = OC_Helper::linkTo('lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token; |
||||
OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => 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)); |
||||
} |
@ -0,0 +1,27 @@ |
||||
<?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 wants to reset their password: |
||||
if(isset($_GET['token']) && isset($_GET['user']) && OC_Preferences::getValue($_GET['user'], 'owncloud', 'lostpassword') === $_GET['token']) { |
||||
if (isset($_POST['password'])) { |
||||
if (OC_User::setPassword($_GET['user'], $_POST['password'])) { |
||||
OC_Preferences::deleteKey($_GET['user'], 'owncloud', 'lostpassword'); |
||||
OC_Template::printGuestPage('lostpassword', 'resetpassword', array('success' => 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)); |
||||
} |
@ -1,4 +1,4 @@ |
||||
<form action="<?php echo 'index.php?'.$_SERVER['QUERY_STRING']; ?>" method="post">
|
||||
<form action="<?php echo 'resetpassword.php?'.$_SERVER['QUERY_STRING']; ?>" method="post">
|
||||
<fieldset> |
||||
<?php if($_['success']): ?> |
||||
<?php echo $l->t('Your password was reset'); ?> |
Loading…
Reference in new issue