Welcome to mirror list, hosted at ThFree Co, Russian Federation.

resetpassword.php « lostpassword « core - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7cd383921d7ebc62aaf2ed481c002e44dbd0f258 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?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 wants to reset their password:
if(isset($_GET['token']) && isset($_GET['user']) && OC_Preferences::getValue($_GET['user'], 'owncloud', 'lostpassword') === hash("sha256", $_GET['token'])) {
	if (isset($_POST['password'])) {
		if (OC_User::setPassword($_GET['user'], $_POST['password'])) {
			OC_Preferences::deleteKey($_GET['user'], 'owncloud', 'lostpassword');
			OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => true));
		} else {
			OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => false));
		}
	} else {
		OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => false));
	}
} else {
	// Someone lost their password
	OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => false));
}