mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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:
@@ -2963,4 +2963,14 @@ describe Guardian do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#auth_token' do
|
||||
it 'returns the correct auth token' do
|
||||
token = UserAuthToken.generate!(user_id: user.id)
|
||||
env = Rack::MockRequest.env_for("/", "HTTP_COOKIE" => "_t=#{token.unhashed_auth_token};")
|
||||
|
||||
guardian = Guardian.new(user, Rack::Request.new(env))
|
||||
expect(guardian.auth_token).to eq(token.auth_token)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user