mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
related to #2158 update user and guest pop in
- Implementation of a new modal for modifying a user or guest - Addition of a function to allow plugins to add a tab to the new user modal - Fix bug: "badger-number" is updated when a user is added or deleted - Fix bug: When the user who is editing has permissions to delete the user he is modifying, the delete icon is now displayed correctly - Added a new api method for modifying the main user and generating a link to reset a password - Passed $conf[‘webmaster_id’] in database configuration
This commit is contained in:
@@ -1733,6 +1733,41 @@ function deactivate_password_reset_key($user_id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate reset password link
|
||||
*
|
||||
* @since 15
|
||||
* @param int $user_id
|
||||
* @param string $user_email
|
||||
* @return array activation_key and reset password link
|
||||
*/
|
||||
function generate_reset_password_link($user_id)
|
||||
{
|
||||
$activation_key = generate_key(20);
|
||||
|
||||
list($expire) = pwg_db_fetch_row(pwg_query('SELECT ADDDATE(NOW(), INTERVAL 1 HOUR)'));
|
||||
|
||||
single_update(
|
||||
USER_INFOS_TABLE,
|
||||
array(
|
||||
'activation_key' => pwg_password_hash($activation_key),
|
||||
'activation_key_expire' => $expire,
|
||||
),
|
||||
array('user_id' => $user_id)
|
||||
);
|
||||
|
||||
set_make_full_url();
|
||||
|
||||
$reset_password_link = get_root_url().'password.php?key='.$activation_key;
|
||||
|
||||
unset_make_full_url();
|
||||
|
||||
return array(
|
||||
'activation_key' => $activation_key,
|
||||
'reset_password_link' => $reset_password_link,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last visit (datetime) of a user, based on history table
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user