nextcloud/core/lostpassword/resetpassword.php

28 lines
1.1 KiB
PHP
Raw Normal View History

2011-09-26 01:33:22 +04:00
<?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');
2011-09-26 01:33:22 +04:00
// 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');
2011-10-03 22:41:52 +04:00
OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => true));
2011-09-26 01:33:22 +04:00
} else {
2011-10-03 22:41:52 +04:00
OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => false));
2011-09-26 01:33:22 +04:00
}
} else {
2011-10-03 22:41:52 +04:00
OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => false));
2011-09-26 01:33:22 +04:00
}
} else {
// Someone lost their password
2011-10-03 22:41:52 +04:00
OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => false));
2011-09-26 01:33:22 +04:00
}