class ClientBlacklist::BlacklistFilter
Rails Before Filter Class Implementation
Public Class Methods
before(controller)
click to toggle source
# File lib/kill_switch/client_blacklist.rb, line 80 def self.before(controller) user_agent = controller.request.user_agent unless ClientBlacklist.user_agent_valid?(user_agent) controller.render( json: { data: { message: "User agent string is missing or invalid. Received [#{user_agent}]" }, metadata: nil, }, status: 400, ) return false end if ClientBlacklist.agent_blacklisted?(user_agent) controller.render( json: { data: { message: "This version [#{user_agent}] is no longer supported. Please visit the App Store to upgrade to the most recent version." }, metadata: nil, }, status: 403, ) return false end return true # All checks passed end