mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 06:51:27 +08:00
FIX: Check if auth token exists before revocation (#9095)
This commit is contained in:
@ -1347,7 +1347,7 @@ class UsersController < ApplicationController
|
||||
if params[:token_id]
|
||||
token = UserAuthToken.find_by(id: params[:token_id], user_id: user.id)
|
||||
# The user should not be able to revoke the auth token of current session.
|
||||
raise Discourse::InvalidParameters.new(:token_id) if guardian.auth_token == token.auth_token
|
||||
raise Discourse::InvalidParameters.new(:token_id) if !token || guardian.auth_token == token.auth_token
|
||||
UserAuthToken.where(id: params[:token_id], user_id: user.id).each(&:destroy!)
|
||||
|
||||
MessageBus.publish "/file-change", ["refresh"], user_ids: [user.id]
|
||||
|
Reference in New Issue
Block a user