mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
Cross-port a patch from 2.0.20 into the 3.0 branch
git-svn-id: file:///svn/phpbb/trunk@5660 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -763,6 +763,29 @@ class session
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all login keys for the specified user
|
||||
*
|
||||
* This method removes all current login keys for a specified (or the current)
|
||||
* user. It will be called on password change to render old keys unusable
|
||||
*/
|
||||
function reset_login_keys($user_id = false)
|
||||
{
|
||||
global $config, $db;
|
||||
|
||||
$user_id = ($user_id === false) ? $this->data['user_id'] : $user_id;
|
||||
|
||||
$sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' WHERE user_id = ' . (int) $user_id;
|
||||
$db->sql_query($sql);
|
||||
|
||||
// We're changing the password of the current user and they have a key
|
||||
// Lets regenerate it to be safe
|
||||
if ($user_id === $this->data['user_id'] && $this->cookie_data['k'])
|
||||
{
|
||||
$this->set_login_key($user_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user