RUBYCRITIC
class Embedded::InternalController < ApplicationController - Embedded::InternalController assumes too much for instance variable '@chatwoot'
- Embedded::InternalController assumes too much for instance variable '@current_account'
- Embedded::InternalController has no descriptive comment
before_action :authenticate_app
def authenticate_app - Embedded::InternalController#authenticate_app has approx 8 statements
token = params['token']
begin
@chatwoot = Apps::Chatwoot.find_by_embedding_token(token)
@current_account = @chatwoot.account
@current_user = @current_account.users.first
rescue ActiveRecord::RecordNotFound => e
render json: { errors: e.message }, status: :unauthorized -
-
rescue JWT::DecodeError => e
render json: { errors: e.message }, status: :unauthorized
end
end
end