1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-07-31 13:20:11 +02:00

Move essence of 'deleteRememberDirectiveForUserById' to 'UserManager'

This commit is contained in:
Marco
2018-03-20 16:09:25 +01:00
parent 4115340927
commit a63e5ec053
2 changed files with 20 additions and 16 deletions

View File

@@ -439,22 +439,8 @@ final class Auth extends UserManager {
$this->setRememberCookie($selector, $token, $expires);
}
/**
* 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
* @throws AuthError if an internal problem occurred (do *not* catch)
*/
private function deleteRememberDirectiveForUserById($userId) {
try {
$this->db->delete(
$this->dbTablePrefix . 'users_remembered',
[ 'user' => $userId ]
);
}
catch (Error $e) {
throw new DatabaseError();
}
protected function deleteRememberDirectiveForUserById($userId) {
parent::deleteRememberDirectiveForUserById($userId);
$this->setRememberCookie(null, null, \time() - 3600);
}

View File

@@ -358,4 +358,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
* @throws AuthError if an internal problem occurred (do *not* catch)
*/
protected function deleteRememberDirectiveForUserById($userId) {
try {
$this->db->delete(
$this->dbTablePrefix . 'users_remembered',
[ 'user' => $userId ]
);
}
catch (Error $e) {
throw new DatabaseError();
}
}
}