feat: Fetching the portal data related to a specific custom domain (#5249)

This commit is contained in:
Tejaswini Chile
2022-09-07 12:22:24 +05:30
committed by GitHub
parent 6574407636
commit db73d033b7
11 changed files with 74 additions and 35 deletions

View File

@@ -3,4 +3,19 @@
class PublicController < ActionController::Base
include RequestExceptionHandler
skip_before_action :verify_authenticity_token
private
def ensure_custom_domain_request
custom_domain = request.host
@portals = ::Portal.where(custom_domain: custom_domain)
return if @portals.present?
render json: {
error: "Domain: #{custom_domain} is not registered with us. \
Please send us an email at support@chatwoot.com with the custom domain name and account API key"
}, status: :unauthorized and return
end
end