blake
(Blake Erickson)
27 augustus 2020 om 23:23
5
Via a plugin you can add your new route to the DiscoursePluginRegistry.api_parameter_routes so that you can continue to pass in api credentials via query parameters:
# clear the profiling cookie to keep stuff tidy
cookie_jar.delete("__profilin")
end
PushNotificationPusher.clear_subscriptions(user)
user.logged_out
elsif user && @user_token
@user_token.destroy
PushNotificationPusher.unsubscribe(user, push_subscription) if push_subscription
DiscourseEvent.trigger(:user_logged_out, user)
end
cookie_jar.delete("authentication_data")
cookie_jar.delete(TOKEN_COOKIE)
end
# api has special rights return true if api was detected
def is_api?
current_user
!!@env[API_KEY_ENV]
end