mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-07-30 21:00:13 +02:00
Permit restriction to selector in 'deleteRememberDirectiveForUserById'
This commit is contained in:
@@ -454,8 +454,8 @@ final class Auth extends UserManager {
|
||||
$this->setRememberCookie($selector, $token, $expires);
|
||||
}
|
||||
|
||||
protected function deleteRememberDirectiveForUserById($userId) {
|
||||
parent::deleteRememberDirectiveForUserById($userId);
|
||||
protected function deleteRememberDirectiveForUserById($userId, $selector = null) {
|
||||
parent::deleteRememberDirectiveForUserById($userId, $selector);
|
||||
|
||||
$this->setRememberCookie(null, null, \time() - 3600);
|
||||
}
|
||||
|
@@ -371,13 +371,22 @@ abstract class UserManager {
|
||||
* Clears an existing directive that keeps the user logged in ("remember me")
|
||||
*
|
||||
* @param int $userId the ID of the user who shouldn't be kept signed in anymore
|
||||
* @param string $selector (optional) the selector which the deletion should be restricted to
|
||||
* @throws AuthError if an internal problem occurred (do *not* catch)
|
||||
*/
|
||||
protected function deleteRememberDirectiveForUserById($userId) {
|
||||
protected function deleteRememberDirectiveForUserById($userId, $selector = null) {
|
||||
$whereMappings = [];
|
||||
|
||||
if (isset($selector)) {
|
||||
$whereMappings['selector'] = (string) $selector;
|
||||
}
|
||||
|
||||
$whereMappings['user'] = (int) $userId;
|
||||
|
||||
try {
|
||||
$this->db->delete(
|
||||
$this->dbTablePrefix . 'users_remembered',
|
||||
[ 'user' => $userId ]
|
||||
$whereMappings
|
||||
);
|
||||
}
|
||||
catch (Error $e) {
|
||||
|
Reference in New Issue
Block a user