mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 21:00:39 +08:00
[Legacy] Fix change password
This commit is contained in:
parent
a7e68066bc
commit
acbfb0b025
1 changed files with 12 additions and 5 deletions
|
@ -105,12 +105,12 @@ if (!empty($_REQUEST['guid']) && !empty($_REQUEST['key'])) {
|
|||
}
|
||||
|
||||
if (!$expired) {
|
||||
$password = $_POST['new_password'] ?? '';
|
||||
$usr = new user();
|
||||
$errors = $usr->passwordValidationCheck($password);
|
||||
// if the form is filled and we want to login
|
||||
if (isset($_REQUEST['login']) && $_REQUEST['login'] == '1') {
|
||||
if ($row['username'] == $_POST['user_name']) {
|
||||
$password = $_POST['new_password'];
|
||||
$usr = new user();
|
||||
$errors = $usr->passwordValidationCheck($password);
|
||||
if (!$errors) {
|
||||
$usr_id = $usr->retrieve_user_id($_POST['user_name']);
|
||||
$usr->retrieve($usr_id);
|
||||
|
@ -136,8 +136,15 @@ if (!empty($_REQUEST['guid']) && !empty($_REQUEST['key'])) {
|
|||
}
|
||||
} else {
|
||||
$redirect = false;
|
||||
if ($_REQUEST['redirect'] === '1') {
|
||||
$redirect = true;
|
||||
if (!$errors && !empty($password)){
|
||||
$usr_id = $usr->retrieve_user_id($_POST['user_name']);
|
||||
$usr->retrieve($usr_id);
|
||||
$usr->setNewPassword($password);
|
||||
$query2 = "UPDATE users_password_link SET deleted='1' where id='" . $db->quote($_REQUEST['guid']) . "'";
|
||||
DBManagerFactory::getInstance()->query($query2, true, "Error setting link for $usr->user_name: ");
|
||||
if ($_REQUEST['redirect'] === '1') {
|
||||
$redirect = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue