2005-08-09 18:46:53 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
2014-12-23 18:47:18 +00:00
|
|
|
// Copyright (C) 2014 University of California
|
2008-08-05 22:43:14 +00:00
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC 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 Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2005-08-09 18:46:53 +00:00
|
|
|
|
2007-11-12 22:28:17 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2005-08-09 18:46:53 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/user.inc");
|
2018-04-04 18:47:26 +00:00
|
|
|
require_once("../inc/password_compat/password.inc");
|
2005-08-09 18:46:53 +00:00
|
|
|
|
2011-02-09 22:11:34 +00:00
|
|
|
check_get_args(array());
|
|
|
|
|
2014-12-23 18:47:18 +00:00
|
|
|
$user = get_logged_in_user();
|
2008-06-11 19:36:10 +00:00
|
|
|
$email_addr = strtolower(post_str("email_addr", true));
|
2005-08-09 18:46:53 +00:00
|
|
|
|
2008-06-11 19:36:10 +00:00
|
|
|
$passwd = post_str("passwd");
|
2005-10-07 19:19:07 +00:00
|
|
|
|
|
|
|
$config = get_config();
|
|
|
|
$min_passwd_length = parse_config($config, "<min_passwd_length>");
|
|
|
|
if (!$min_passwd_length) $min_passwd_length = 6;
|
|
|
|
|
2005-10-08 19:12:43 +00:00
|
|
|
if (!is_ascii($passwd)) {
|
2011-08-25 22:12:48 +00:00
|
|
|
error_page(tra("Passwords may only include ASCII characters."));
|
2005-10-07 23:19:20 +00:00
|
|
|
}
|
|
|
|
|
2014-12-23 18:47:18 +00:00
|
|
|
if (strlen($passwd) < $min_passwd_length) {
|
2011-08-25 22:12:48 +00:00
|
|
|
error_page(tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length));
|
2005-10-07 14:28:08 +00:00
|
|
|
}
|
2005-08-09 18:46:53 +00:00
|
|
|
|
|
|
|
$passwd_hash = md5($passwd.$user->email_addr);
|
2018-03-13 21:49:14 +00:00
|
|
|
$database_passwd_hash = password_hash($passwd_hash, PASSWORD_DEFAULT);
|
|
|
|
$result = $user->update(" passwd_hash='$database_passwd_hash' ");
|
2014-12-23 18:47:18 +00:00
|
|
|
if (!$result) {
|
|
|
|
error_page(tra("We can't update your password due to a database problem. Please try again later."));
|
2005-08-09 18:46:53 +00:00
|
|
|
}
|
|
|
|
|
2014-12-23 18:47:18 +00:00
|
|
|
page_head(tra("Change password"));
|
|
|
|
echo tra("Your password has been changed.");
|
2005-08-09 18:46:53 +00:00
|
|
|
page_tail();
|
2014-12-23 18:47:18 +00:00
|
|
|
|
2005-08-09 18:46:53 +00:00
|
|
|
?>
|