diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-15 18:06:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-15 18:06:24 +0000 |
commit | eca3cd3a9e7d9ea680086cad8150050ec8cdef3f (patch) | |
tree | c3d262e0d8e721fc138c2d617f501fb09876f1b6 /app/views/projects/pages_domains | |
parent | 6e81d7f6283fae1b22f66b9d9b133243921cbd9e (diff) | |
download | gitlab-ce-eca3cd3a9e7d9ea680086cad8150050ec8cdef3f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/views/projects/pages_domains')
7 files changed, 138 insertions, 76 deletions
diff --git a/app/views/projects/pages_domains/_certificate.html.haml b/app/views/projects/pages_domains/_certificate.html.haml index 42631fca5e8..92d30e0b056 100644 --- a/app/views/projects/pages_domains/_certificate.html.haml +++ b/app/views/projects/pages_domains/_certificate.html.haml @@ -1,18 +1,63 @@ -- if @domain.auto_ssl_enabled? - - if @domain.enabled? - - if @domain.certificate_text - %pre - = @domain.certificate_text - - else - .bs-callout.bs-callout-info - = _("GitLab is obtaining a Let's Encrypt SSL certificate for this domain. This process can take some time. Please try again later.") +- auto_ssl_available = ::Gitlab::LetsEncrypt.enabled? +- auto_ssl_enabled = @domain.auto_ssl_enabled? +- auto_ssl_available_and_enabled = auto_ssl_available && auto_ssl_enabled +- has_user_defined_certificate = @domain.certificate && @domain.certificate_user_provided? + +- if auto_ssl_available + .form-group.border-section + .row + .col-sm-2 + = _('Certificate') + .col-sm-10.js-auto-ssl-toggle-container + %label{ for: "pages_domain_auto_ssl_enabled_button" } + - lets_encrypt_link_url = "https://letsencrypt.org/" + - lets_encrypt_link_start = "<a href=\"%{lets_encrypt_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { lets_encrypt_link_url: lets_encrypt_link_url } + - lets_encrypt_link_end = "</a>".html_safe + = _("Automatic certificate management using %{lets_encrypt_link_start}Let's Encrypt%{lets_encrypt_link_end}").html_safe % { lets_encrypt_link_start: lets_encrypt_link_start, lets_encrypt_link_end: lets_encrypt_link_end } + %button{ type: "button", id: "pages_domain_auto_ssl_enabled_button", + class: "js-project-feature-toggle project-feature-toggle mt-2 #{"is-checked" if auto_ssl_available_and_enabled}", + "aria-label": _("Automatic certificate management using Let's Encrypt") } + = f.hidden_field :auto_ssl_enabled?, class: "js-project-feature-toggle-input" + %span.toggle-icon + = sprite_icon("status_success_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-checked") + = sprite_icon("status_failed_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-unchecked") + %p.text-secondary.mt-3 + - docs_link_url = help_page_path("user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md") + - docs_link_start = "<a href=\"%{docs_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { docs_link_url: docs_link_url } + - docs_link_end = "</a>".html_safe + = _("Let's Encrypt is a free, automated, and open certificate authority (CA) that gives digital certificates in order to enable HTTPS (SSL/TLS) for websites. Learn more about Let's Encrypt configuration by following the %{docs_link_start}documentation on GitLab Pages%{docs_link_end}.").html_safe % { docs_link_url: docs_link_url, docs_link_start: docs_link_start, docs_link_end: docs_link_end } + +.form-group.border-section.js-shown-unless-auto-ssl{ class: ("d-none" if auto_ssl_available_and_enabled) } + - if has_user_defined_certificate + .row + .col-sm-10.offset-sm-2 + .card + .card-header + = _('Certificate') + .d-flex.justify-content-between.align-items-center.p-3 + %span + = @domain.subject || _('missing') + = link_to _('Remove'), + clean_certificate_project_pages_domain_path(@project, @domain), + data: { confirm: _('Are you sure?') }, + class: 'btn btn-remove btn-sm', + method: :delete - else - .bs-callout.bs-callout-warning - = _("A Let's Encrypt SSL certificate can not be obtained until your domain is verified.") -- else - - if @domain.certificate_text - %pre - = @domain.certificate_text - - else - .light - = _("missing") + .row + .col-sm-10.offset-sm-2 + = f.label :user_provided_certificate, _("Certificate (PEM)") + = f.text_area :user_provided_certificate, + rows: 5, + class: "form-control js-enabled-unless-auto-ssl", + disabled: auto_ssl_available_and_enabled + %span.help-inline.text-muted= _("Upload a certificate for your domain with all intermediates") + .row + .col-sm-10.offset-sm-2 + = f.label :user_provided_key, _("Key (PEM)") + = f.text_area :user_provided_key, + rows: 5, + class: "form-control js-enabled-unless-auto-ssl", + disabled: auto_ssl_available_and_enabled + %span.help-inline.text-muted= _("Upload a private key for your certificate") + += render 'lets_encrypt_callout', auto_ssl_available_and_enabled: auto_ssl_available_and_enabled diff --git a/app/views/projects/pages_domains/_dns.html.haml b/app/views/projects/pages_domains/_dns.html.haml new file mode 100644 index 00000000000..e4e590f0a98 --- /dev/null +++ b/app/views/projects/pages_domains/_dns.html.haml @@ -0,0 +1,33 @@ +- verification_enabled = Gitlab::CurrentSettings.pages_domain_verification_enabled? +- dns_record = "#{@domain.domain} CNAME #{@domain.project.pages_subdomain}.#{Settings.pages.host}." + +.form-group.border-section + .row + .col-sm-2 + = _("DNS") + .col-sm-10 + .input-group + = text_field_tag :domain_dns, dns_record , class: "monospace js-select-on-focus form-control", readonly: true + .input-group-append + = clipboard_button(target: '#domain_dns', class: 'btn-default input-group-text d-none d-sm-block') + %p.form-text.text-muted + = _("To access this domain create a new DNS record") +- if verification_enabled + - verification_record = "#{@domain.verification_domain} TXT #{@domain.keyed_verification_code}" + .form-group.border-section + .row + .col-sm-2 + = _("Verification status") + .col-sm-10 + .status-badge + - text, status = @domain.unverified? ? [_('Unverified'), 'badge-danger'] : [_('Verified'), 'badge-success'] + .badge{ class: status } + = text + = link_to sprite_icon("redo"), verify_project_pages_domain_path(@project, @domain), method: :post, class: "btn has-tooltip", title: _("Retry verification") + .input-group + = text_field_tag :domain_verification, verification_record, class: "monospace js-select-on-focus form-control", readonly: true + .input-group-append + = clipboard_button(target: '#domain_verification', class: 'btn-default d-none d-sm-block') + %p.form-text.text-muted + - link_to_help = link_to(_('verify ownership'), help_page_path('user/project/pages/custom_domains_ssl_tls_certification/index.md', anchor: '4-verify-the-domains-ownership')) + = _("To %{link_to_help} of your domain, add the above key to a TXT record within to your DNS configuration.").html_safe % { link_to_help: link_to_help } diff --git a/app/views/projects/pages_domains/_form.html.haml b/app/views/projects/pages_domains/_form.html.haml index 4aa1e574d93..e06dab9be06 100644 --- a/app/views/projects/pages_domains/_form.html.haml +++ b/app/views/projects/pages_domains/_form.html.haml @@ -3,62 +3,25 @@ - @domain.errors.full_messages.each do |msg| = msg -.form-group.row - .col-sm-2.col-form-label - = f.label :domain, _("Domain") - .col-sm-10 - = f.text_field :domain, required: true, autocomplete: "off", class: "form-control", disabled: @domain.persisted? - -- if Gitlab.config.pages.external_https - - - auto_ssl_available = ::Gitlab::LetsEncrypt.enabled? - - auto_ssl_enabled = @domain.auto_ssl_enabled? - - auto_ssl_available_and_enabled = auto_ssl_available && auto_ssl_enabled - - - if auto_ssl_available - .form-group.row - .col-sm-2.col-form-label - %label{ for: "pages_domain_auto_ssl_enabled_button" } - - lets_encrypt_link_url = "https://letsencrypt.org/" - - lets_encrypt_link_start = "<a href=\"%{lets_encrypt_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { lets_encrypt_link_url: lets_encrypt_link_url } - - lets_encrypt_link_end = "</a>".html_safe - = _("Automatic certificate management using %{lets_encrypt_link_start}Let's Encrypt%{lets_encrypt_link_end}").html_safe % { lets_encrypt_link_start: lets_encrypt_link_start, lets_encrypt_link_end: lets_encrypt_link_end } - - .col-sm-10.js-auto-ssl-toggle-container - %button{ type: "button", id: "pages_domain_auto_ssl_enabled_button", - class: "js-project-feature-toggle project-feature-toggle mt-2 #{"is-checked" if auto_ssl_available_and_enabled}", - "aria-label": _("Automatic certificate management using Let's Encrypt") } - = f.hidden_field :auto_ssl_enabled?, class: "js-project-feature-toggle-input" - %span.toggle-icon - = sprite_icon("status_success_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-checked") - = sprite_icon("status_failed_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-unchecked") - %p.text-secondary.mt-3 - - docs_link_url = help_page_path("user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md") - - docs_link_start = "<a href=\"%{docs_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { docs_link_url: docs_link_url } - - docs_link_end = "</a>".html_safe - = _("Let's Encrypt is a free, automated, and open certificate authority (CA) that gives digital certificates in order to enable HTTPS (SSL/TLS) for websites. Learn more about Let's Encrypt configuration by following the %{docs_link_start}documentation on GitLab Pages%{docs_link_end}.").html_safe % { docs_link_url: docs_link_url, docs_link_start: docs_link_start, docs_link_end: docs_link_end } - - .js-shown-unless-auto-ssl{ class: ("d-none" if auto_ssl_available_and_enabled) } - .form-group.row - .col-sm-2.col-form-label - = f.label :user_provided_certificate, _("Certificate (PEM)") +.form-group.border-section + .row + - if @domain.persisted? + .col-sm-2 + = _("Domain") .col-sm-10 - = f.text_area :user_provided_certificate, - rows: 5, - class: "form-control js-enabled-unless-auto-ssl", - disabled: auto_ssl_available_and_enabled - %span.help-inline.text-muted= _("Upload a certificate for your domain with all intermediates") - - .form-group.row - .col-sm-2.col-form-label - = f.label :user_provided_key, _("Key (PEM)") + = external_link(@domain.url, @domain.url) + - else + .col-sm-2 + = f.label :domain, _("Domain") .col-sm-10 - = f.text_area :user_provided_key, - rows: 5, - class: "form-control js-enabled-unless-auto-ssl", - disabled: auto_ssl_available_and_enabled - %span.help-inline.text-muted= _("Upload a private key for your certificate") + .input-group + = f.text_field :domain, required: true, autocomplete: "off", class: "form-control" +- if @domain.persisted? + = render 'dns' + +- if Gitlab.config.pages.external_https + = render 'certificate', f: f - else - .nothing-here-block + .border-section.nothing-here-block = _("Support for custom certificates is disabled. Ask your system's administrator to enable it.") diff --git a/app/views/projects/pages_domains/_lets_encrypt_callout.html.haml b/app/views/projects/pages_domains/_lets_encrypt_callout.html.haml new file mode 100644 index 00000000000..d6406a78fca --- /dev/null +++ b/app/views/projects/pages_domains/_lets_encrypt_callout.html.haml @@ -0,0 +1,13 @@ +- if @domain.enabled? + - if @domain.auto_ssl_enabled && !@domain.certificate + .form-group.border-section.js-shown-if-auto-ssl{ class: ("d-none" unless auto_ssl_available_and_enabled) } + .row + .col-sm-10.offset-sm-2 + .bs-callout.bs-callout-info.mt-0 + = _("GitLab is obtaining a Let's Encrypt SSL certificate for this domain. This process can take some time. Please try again later.") +- else + .form-group.border-section.js-shown-if-auto-ssl{ class: ("d-none" unless auto_ssl_available_and_enabled) } + .row + .col-sm-10.offset-sm-2 + .bs-callout.bs-callout-warning.mt-0 + = _("A Let's Encrypt SSL certificate can not be obtained until your domain is verified.") diff --git a/app/views/projects/pages_domains/edit.html.haml b/app/views/projects/pages_domains/edit.html.haml index 7c0777e5496..a08be65d7e4 100644 --- a/app/views/projects/pages_domains/edit.html.haml +++ b/app/views/projects/pages_domains/edit.html.haml @@ -1,12 +1,21 @@ - add_to_breadcrumbs _("Pages"), project_pages_path(@project) - breadcrumb_title @domain.domain - page_title @domain.domain + +- verification_enabled = Gitlab::CurrentSettings.pages_domain_verification_enabled? + +- if verification_enabled && @domain.unverified? + = content_for :flash_message do + .alert.alert-warning + .container-fluid.container-limited + = _("This domain is not verified. You will need to verify ownership before access is enabled.") + %h3.page-title - = @domain.domain + = _('Pages Domain') = render 'projects/pages_domains/helper_text' -%hr.clearfix %div = form_for [@project.namespace.becomes(Namespace), @project, @domain], html: { class: 'fieldset-form' } do |f| = render 'form', { f: f } - .form-actions + .form-actions.d-flex.justify-content-between = f.submit _('Save Changes'), class: "btn btn-success" + = link_to _('Cancel'), project_pages_path(@project), class: 'btn btn-default btn-inverse' diff --git a/app/views/projects/pages_domains/new.html.haml b/app/views/projects/pages_domains/new.html.haml index e23ccb5d4c6..3210bfe9231 100644 --- a/app/views/projects/pages_domains/new.html.haml +++ b/app/views/projects/pages_domains/new.html.haml @@ -3,7 +3,6 @@ %h3.page-title = _("New Pages Domain") = render 'projects/pages_domains/helper_text' -%hr.clearfix %div = form_for [@project.namespace.becomes(Namespace), @project, @domain], html: { class: 'fieldset-form' } do |f| = render 'form', { f: f } diff --git a/app/views/projects/pages_domains/show.html.haml b/app/views/projects/pages_domains/show.html.haml index 33837e21c8d..8eec3d51835 100644 --- a/app/views/projects/pages_domains/show.html.haml +++ b/app/views/projects/pages_domains/show.html.haml @@ -58,4 +58,4 @@ %td = _("Certificate") %td - = render 'certificate' + = render 'lets_encrypt_callout', auto_ssl_available_and_enabled: false |