mirror of
https://github.com/discourse/discourse.git
synced 2025-09-09 19:03:09 +08:00
FIX: Do not allow revoking the token of current session. (#6472)
* FIX: Do not allow revoking the token of current session. * DEV: Add getter of current auth_token from Guardian.
This commit is contained in:
parent
e68ecf1f1d
commit
048cdfbcfa
5 changed files with 28 additions and 16 deletions
|
@ -381,6 +381,13 @@ class Guardian
|
|||
(components - Theme.components_for(parent)).empty?
|
||||
end
|
||||
|
||||
def auth_token
|
||||
return nil if !request&.cookies[Auth::DefaultCurrentUserProvider::TOKEN_COOKIE]
|
||||
|
||||
cookie = request.cookies[Auth::DefaultCurrentUserProvider::TOKEN_COOKIE]
|
||||
UserAuthToken.hash_token(cookie)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def is_my_own?(obj)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue