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
|
|
@ -4,7 +4,9 @@ module Admin
|
|||
load_resource :program, through: :conference, singleton: true, except: :index
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,28 @@ class Conference < ActiveRecord::Base
|
|||
user.present? && registrations.where(user_id: user.id).count > 0
|
||||
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
|
||||
# After the conference has been successfully updated
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@
|
|||
%h2
|
||||
Step 3:
|
||||
%strong
|
||||
Unfortunately, we can't do this for you and you have to perform this step with the help your domain registrar!
|
||||
Unfortunately, we can't do this for you and you have to perform this step with the help your domain registrar!
|
||||
%p
|
||||
The last step is adding a CNAME record in your registrar’s DNS Settings. Different registrars have different ways of adding a CNAME record. The following guides would help you setup a CNAME record depending upon the registrar of your domain. If it doesn’t, you probably should get in touch with your domain registrar and ask him how to register a CNAME record in their platform.
|
||||
%ul
|
||||
%li
|
||||
%li
|
||||
= link_to 'GoDaddy', 'https://in.godaddy.com/help/add-a-cname-record-19236'
|
||||
%li
|
||||
%li
|
||||
= link_to 'Namecheap', 'https://www.namecheap.com/support/knowledgebase/article.aspx/9646/2237/how-can-i-set-up-a-cname-record-for-my-domain'
|
||||
%li
|
||||
= link_to 'BlueHost', 'https://my.bluehost.com/cgi/help/cname#creating_a_cname'
|
||||
|
|
|
|||
|
|
@ -17,7 +17,14 @@
|
|||
%td
|
||||
= @conference.custom_domain
|
||||
%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
|
||||
.btn-group
|
||||
= link_to 'Edit', attach_custom_domain_admin_conference_path(@conference.short_title),
|
||||
|
|
@ -51,7 +58,7 @@
|
|||
CNAME:
|
||||
A Canonical Name record is a resource used which defines that your domain name is an alias for another domain name.
|
||||
%p
|
||||
To add your own domain you can follow these
|
||||
To add your own domain you can follow these
|
||||
%i
|
||||
three
|
||||
steps:
|
||||
|
|
@ -63,9 +70,9 @@
|
|||
%li
|
||||
The last step is adding a CNAME record in your registrar’s DNS Settings. Different registrars have different ways of adding a CNAME record. The following guides would help you setup a CNAME record depending upon the registrar of your domain. If it doesn’t, you probably should get in touch with your domain registrar and ask him how to register a CNAME record in their platform.
|
||||
%ul
|
||||
%li
|
||||
%li
|
||||
= link_to 'GoDaddy', 'https://in.godaddy.com/help/add-a-cname-record-19236'
|
||||
%li
|
||||
%li
|
||||
= link_to 'Namecheap', 'https://www.namecheap.com/support/knowledgebase/article.aspx/9646/2237/how-can-i-set-up-a-cname-record-for-my-domain'
|
||||
%li
|
||||
= link_to 'BlueHost', 'https://my.bluehost.com/cgi/help/cname#creating_a_cname'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue