introduced ability to auto detect CNAME of custom domain
This commit is contained in:
parent
a612c2e5ea
commit
b1624a6812
5 changed files with 41 additions and 8 deletions
|
|
@ -31,6 +31,8 @@ linters:
|
||||||
- "app/views/admin/conferences/_targets.html.haml"
|
- "app/views/admin/conferences/_targets.html.haml"
|
||||||
- "app/views/admin/conferences/_todo_list.html.haml"
|
- "app/views/admin/conferences/_todo_list.html.haml"
|
||||||
- "app/views/admin/conferences/_top_submitter.html.haml"
|
- "app/views/admin/conferences/_top_submitter.html.haml"
|
||||||
|
- "app/views/admin/conferences/attach_custom_domain.html.haml"
|
||||||
|
- "app/views/admin/conferences/custom_domain.html.haml"
|
||||||
- "app/views/admin/conferences/edit.html.haml"
|
- "app/views/admin/conferences/edit.html.haml"
|
||||||
- "app/views/admin/conferences/index.html.haml"
|
- "app/views/admin/conferences/index.html.haml"
|
||||||
- "app/views/admin/conferences/new.html.haml"
|
- "app/views/admin/conferences/new.html.haml"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ module Admin
|
||||||
load_resource :program, through: :conference, singleton: true, except: :index
|
load_resource :program, through: :conference, singleton: true, except: :index
|
||||||
load_resource :user, only: [:remove_user]
|
load_resource :user, only: [:remove_user]
|
||||||
|
|
||||||
def custom_domain; end
|
def custom_domain
|
||||||
|
redirect_to attach_custom_domain_admin_conference_path(@conference.short_title) unless @conference.custom_domain.present?
|
||||||
|
end
|
||||||
|
|
||||||
def attach_custom_domain; end
|
def attach_custom_domain; end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,28 @@ class Conference < ActiveRecord::Base
|
||||||
user.present? && registrations.where(user_id: user.id).count > 0
|
user.present? && registrations.where(user_id: user.id).count > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Checks if domain correctly points to the hosted version
|
||||||
|
# This feature is enabled only if ENV['OSEM_HOSTNAME'] is present
|
||||||
|
#
|
||||||
|
# ====Returns
|
||||||
|
# * +true+ -> If the custom domain has a CNAME record for the hosted version
|
||||||
|
# * +false+ -> If the custom domain does not have a CNAME record for the hosted version
|
||||||
|
def check_custom_domain
|
||||||
|
require 'resolv'
|
||||||
|
|
||||||
|
unless ENV['OSEM_HOSTNAME'].nil?
|
||||||
|
cname_record = Resolv::DNS.new.getresources(custom_domain, Resolv::DNS::Resource::IN::CNAME)
|
||||||
|
if cname_record.present?
|
||||||
|
return ENV['OSEM_HOSTNAME'] == Resolv::DNS.new.getresources(custom_domain, Resolv::DNS::Resource::IN::CNAME).first.name.to_s
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
'--feature disabled--'
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Delete all EventSchedules that are not in the hours range
|
# Delete all EventSchedules that are not in the hours range
|
||||||
# After the conference has been successfully updated
|
# After the conference has been successfully updated
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,14 @@
|
||||||
%td
|
%td
|
||||||
= @conference.custom_domain
|
= @conference.custom_domain
|
||||||
%td
|
%td
|
||||||
= ""
|
- ck_domain = @conference.check_custom_domain
|
||||||
|
- if ck_domain == true
|
||||||
|
%span.glyphicon.glyphicon-ok
|
||||||
|
- elsif ck_domain == false
|
||||||
|
%span.glyphicon.glyphicon-remove
|
||||||
|
- else
|
||||||
|
%i
|
||||||
|
= ck_domain
|
||||||
%td
|
%td
|
||||||
.btn-group
|
.btn-group
|
||||||
= link_to 'Edit', attach_custom_domain_admin_conference_path(@conference.short_title),
|
= link_to 'Edit', attach_custom_domain_admin_conference_path(@conference.short_title),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue