Archived
1
0
Disbranĉigi 0
Ĉi tiu deponejo arĥiviĝis je 2024-01-28. Vi povas vidi kaj elŝuti dosierojn, sed ne povas puŝi nek raporti problemojn nek tirpeti.
blagoblag/u/edit/private/new_password.php
2019-02-23 01:15:14 -06:00

43 lines
1.1 KiB
PHP

<?php
/* This file is free software: you can redistribute it and/or modify
it under the terms of version 3 of the GNU Affero General Public
License as published by the Free Software Foundation.
This file 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 Affero General Public License for more details. */
$depth = "../../../";
include $depth . "res/lib/load.php";
$id = user_logged_in();
$old_password = $_POST['password'];
$password = $_POST['new_password'];
$password_repeat = $_POST['new_password_repeat'];
// -------------------------------------
input_enforce(array($password),
array("Password"),
array("string"));
if ($password != $password_repeat) {
general_error("Your passwords don't match.");
}
if (!user_valid_password($id, $old_password)) {
general_error("Your old password was wrong.");
}
// -------------------------------------
$password = password_hash($password, PASSWORD_BCRYPT, array('cost' => 11));
user_set($id, "hash", $password);
root_redirect("");
?>