Commit bab522d4 authored by Vladimir Shushlin's avatar Vladimir Shushlin

Add warning when LE certificate can't be obtained

* Refactor some tests as well
parent 224db2f8
- 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.")
- 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")
......@@ -60,9 +60,4 @@
%td
= _("Certificate")
%td
- if @domain.certificate_text
%pre
= @domain.certificate_text
- else
.light
= _("missing")
= render 'certificate'
---
title: Add warning to pages domains that obtaining/deploying SSL certificates through
Let's Encrypt can take some time
merge_request: 31765
author:
type: other
......@@ -469,6 +469,9 @@ msgstr ""
msgid "A Jekyll site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features."
msgstr ""
msgid "A Let's Encrypt SSL certificate can not be obtained until your domain is verified."
msgstr ""
msgid "A Let's Encrypt account will be configured for this GitLab installation using your email address. You will receive emails to warn of expiring certificates."
msgstr ""
......@@ -5247,6 +5250,9 @@ msgstr ""
msgid "GitLab User"
msgstr ""
msgid "GitLab is obtaining a Let's Encrypt SSL certificate for this domain. This process can take some time. Please try again later."
msgstr ""
msgid "GitLab member or Email address"
msgstr ""
......
......@@ -75,12 +75,10 @@ describe "Pages with Let's Encrypt", :https_pages_enabled do
end
shared_examples 'user sees private keys only for user provided certificate' do
before do
visit edit_project_pages_domain_path(project, domain)
end
shared_examples 'user do not see private key' do
it 'user do not see private key' do
visit edit_project_pages_domain_path(project, domain)
expect(find_field('Key (PEM)', visible: :all, disabled: :all).value).to be_blank
end
end
......@@ -101,6 +99,8 @@ describe "Pages with Let's Encrypt", :https_pages_enabled do
let(:domain) { create(:pages_domain, project: project) }
it 'user sees private key' do
visit edit_project_pages_domain_path(project, domain)
expect(find_field('Key (PEM)').value).not_to be_blank
end
end
......
require 'spec_helper'
describe 'projects/pages_domains/show' do
let(:project) { create(:project, :repository) }
before do
assign(:project, project)
assign(:domain, domain)
end
context 'when auto_ssl is enabled' do
context 'when domain is disabled' do
let(:domain) { create(:pages_domain, :disabled, project: project, auto_ssl_enabled: true) }
it 'shows verification warning' do
render
expect(rendered).to have_content("A Let's Encrypt SSL certificate can not be obtained until your domain is verified.")
end
end
context 'when certificate is absent' do
let(:domain) { create(:pages_domain, :without_key, :without_certificate, project: project, auto_ssl_enabled: true) }
it 'shows alert about time of obtaining certificate' do
render
expect(rendered).to have_content("GitLab is obtaining a Let's Encrypt SSL certificate for this domain. This process can take some time. Please try again later.")
end
end
context 'when certificate is present' do
let(:domain) { create(:pages_domain, :letsencrypt, project: project) }
it 'shows certificate info' do
render
# test just a random part of cert represenations(X509v3 Subject Key Identifier:)
expect(rendered).to have_content("C6:5F:56:4B:10:69:AC:1D:33:D2:26:C9:B3:7A:D7:12:4D:3E:F7:90")
end
end
end
context 'when auto_ssl is disabled' do
context 'when certificate is present' do
let(:domain) { create(:pages_domain, project: project) }
it 'shows certificate info' do
render
# test just a random part of cert represenations(X509v3 Subject Key Identifier:)
expect(rendered).to have_content("C6:5F:56:4B:10:69:AC:1D:33:D2:26:C9:B3:7A:D7:12:4D:3E:F7:90")
end
end
context 'when certificate is absent' do
let(:domain) { create(:pages_domain, :without_certificate, :without_key, project: project) }
it 'shows missing certificate' do
render
expect(rendered).to have_content("missing")
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment