2019-12-26 22:10:19 +05:30
- auto_ssl_available = ::Gitlab::LetsEncrypt.enabled?
2020-05-24 23:13:21 +05:30
- auto_ssl_enabled = domain_presenter.auto_ssl_enabled?
2019-12-26 22:10:19 +05:30
- auto_ssl_available_and_enabled = auto_ssl_available && auto_ssl_enabled
2020-05-24 23:13:21 +05:30
- has_user_defined_certificate = domain_presenter.certificate && domain_presenter.certificate_user_provided?
2019-12-26 22:10:19 +05:30
- 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 }
2022-05-07 20:08:51 +05:30
= render Pajamas::ToggleComponent.new(id: 'pages_domain_auto_ssl_enabled_button',
classes: 'js-project-feature-toggle js-enable-ssl-gl-toggle mt-2',
is_checked: auto_ssl_available_and_enabled,
label: _("Automatic certificate management using Let's Encrypt"),
label_position: :hidden)
2019-12-26 22:10:19 +05:30
= f.hidden_field :auto_ssl_enabled?, class: "js-project-feature-toggle-input"
2022-05-07 20:08:51 +05:30
%p.gl-text-secondary.gl-mt-1
2019-12-26 22:10:19 +05:30
- 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
2023-05-27 22:25:52 +05:30
= render Pajamas::CardComponent.new(body_options: { class: 'gl-display-flex gl-align-items-center gl-justify-content-space-between gl-p-5' }) do |c|
- c.header do
= s_('Certificate')
- c.body do
2019-12-26 22:10:19 +05:30
%span
2020-05-24 23:13:21 +05:30
= domain_presenter.pages_domain.subject || _('missing')
2019-12-26 22:10:19 +05:30
= link_to _('Remove'),
2020-05-24 23:13:21 +05:30
clean_certificate_project_pages_domain_path(@project, domain_presenter),
2022-07-16 23:28:13 +05:30
data: { confirm: _('Are you sure?'), 'confirm-btn-variant': 'danger' },
'aria-label': s_("GitLabPages|Remove certificate"),
2021-01-03 14:25:43 +05:30
class: 'gl-button btn btn-danger btn-sm',
2019-12-26 22:10:19 +05:30
method: :delete
2019-12-04 20:38:33 +05:30
- else
2019-12-26 22:10:19 +05:30
.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