2011-10-12 06:29:48 +00:00
|
|
|
<?php
|
|
|
|
// MyDMS. Document Management System
|
|
|
|
// Copyright (C) 2002-2005 Markus Westphal
|
|
|
|
// Copyright (C) 2006-2008 Malcolm Cowe
|
2016-08-09 05:34:30 +00:00
|
|
|
// Copyright (C) 2010-2016 Uwe Steinmann
|
2011-10-12 06:29:48 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
include("../inc/inc.Settings.php");
|
2015-11-25 16:01:52 +00:00
|
|
|
include("../inc/inc.LogInit.php");
|
2011-10-12 06:29:48 +00:00
|
|
|
include("../inc/inc.Utils.php");
|
|
|
|
include("../inc/inc.Language.php");
|
2014-12-08 13:47:32 +00:00
|
|
|
include("../inc/inc.Init.php");
|
|
|
|
include("../inc/inc.Extension.php");
|
2011-10-12 06:29:48 +00:00
|
|
|
include("../inc/inc.ClassSession.php");
|
|
|
|
include("../inc/inc.DBInit.php");
|
|
|
|
include("../inc/inc.ClassUI.php");
|
2021-05-12 07:37:48 +00:00
|
|
|
require_once("../inc/inc.ClassAccessOperation.php");
|
2011-10-12 06:29:48 +00:00
|
|
|
|
|
|
|
function _printMessage($heading, $message) {
|
|
|
|
|
|
|
|
UI::htmlStartPage($heading, "password");
|
|
|
|
UI::globalBanner();
|
|
|
|
UI::pageNavigation($heading);
|
|
|
|
UI::contentContainer($message."<p><a href=\"../out/out.Login.php\">" . getMLText("login") . "</a></p>\n");
|
2012-12-14 08:26:13 +00:00
|
|
|
UI::htmlEndPage();
|
2011-10-12 06:29:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-01-25 08:00:28 +00:00
|
|
|
/* Check if the form data comes from a trusted request */
|
|
|
|
if(!checkFormKey('changepassword')) {
|
|
|
|
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_request_token"))),getMLText("invalid_request_token"));
|
|
|
|
}
|
|
|
|
|
2011-10-12 06:29:48 +00:00
|
|
|
if (isset($_POST["hash"])) {
|
2011-12-01 21:29:34 +00:00
|
|
|
$hash = $_POST["hash"];
|
2011-10-12 06:29:48 +00:00
|
|
|
}
|
|
|
|
if (isset($_POST["newpassword"])) {
|
2011-12-01 21:29:34 +00:00
|
|
|
$newpassword = $_POST["newpassword"];
|
2011-10-12 06:29:48 +00:00
|
|
|
}
|
|
|
|
if (isset($_POST["newpasswordrepeat"])) {
|
2011-12-01 21:29:34 +00:00
|
|
|
$newpasswordrepeat = $_POST["newpasswordrepeat"];
|
2011-10-12 06:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($newpassword) || empty($newpasswordrepeat) || $newpassword != $newpasswordrepeat) {
|
2013-01-29 13:11:39 +00:00
|
|
|
UI::exitError(getMLText("password_mismatch_error_title"),getMLText("password_mismatch_error"));
|
2011-10-12 06:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$user = $dms->checkPasswordRequest($hash);
|
|
|
|
if($user) {
|
2020-07-30 08:57:29 +00:00
|
|
|
$user->setPwd(seed_pass_hash($newpassword));
|
2011-10-12 06:29:48 +00:00
|
|
|
$dms->deletePasswordRequest($hash);
|
2013-01-29 13:11:39 +00:00
|
|
|
header('Location: ../out/out.Login.php');
|
|
|
|
exit;
|
2011-10-12 06:29:48 +00:00
|
|
|
}
|
|
|
|
|
2013-01-29 13:11:39 +00:00
|
|
|
UI::exitError(getMLText("password_mismatch_error_title"),getMLText("password_mismatch_error"));
|
|
|
|
|
2011-10-12 06:29:48 +00:00
|
|
|
?>
|
|
|
|
|