Commit fbba57a1 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'jswain_simplify_sign_in' into 'master'

Simplify the sign in page after confirmation

See merge request gitlab-org/gitlab!64370
parents 4936d8b8 8c7d3a45
...@@ -294,11 +294,6 @@ fieldset:disabled a.btn { ...@@ -294,11 +294,6 @@ fieldset:disabled a.btn {
.mb-3 { .mb-3 {
margin-bottom: 1rem !important; margin-bottom: 1rem !important;
} }
@media (min-width: 576px) {
.mt-sm-0 {
margin-top: 0 !important;
}
}
.text-center { .text-center {
text-align: center !important; text-align: center !important;
} }
...@@ -823,6 +818,11 @@ svg { ...@@ -823,6 +818,11 @@ svg {
.gl-mb-5 { .gl-mb-5 {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
@media (min-width: 36rem) {
.gl-sm-mt-0 {
margin-top: 0;
}
}
.gl-text-left { .gl-text-left {
text-align: left; text-align: left;
} }
......
# frozen_string_literal: true # frozen_string_literal: true
module SessionsHelper module SessionsHelper
include Gitlab::Utils::StrongMemoize
def recently_confirmed_com?
strong_memoize(:recently_confirmed_com) do
::Gitlab.dev_env_or_com? &&
!!flash[:notice]&.include?(t(:confirmed, scope: [:devise, :confirmations]))
end
end
def unconfirmed_email? def unconfirmed_email?
flash[:alert] == t(:unconfirmed, scope: [:devise, :failure]) flash[:alert] == t(:unconfirmed, scope: [:devise, :failure])
end end
......
...@@ -17,25 +17,26 @@ ...@@ -17,25 +17,26 @@
= current_appearance&.title.presence || "GitLab" = current_appearance&.title.presence || "GitLab"
.row.mb-3 .row.mb-3
.col-sm-7.order-12.order-sm-1.brand-holder .col-sm-7.order-12.order-sm-1.brand-holder
= brand_image - unless recently_confirmed_com?
- if current_appearance&.description? = brand_image
= brand_text - if current_appearance&.description?
- else = brand_text
%h3.mt-sm-0 - else
= _('A complete DevOps platform') %h3.gl-sm-mt-0
= _('A complete DevOps platform')
%p %p
= _('GitLab is a single application for the entire software development lifecycle. From project planning and source code management to CI/CD, monitoring, and security.') = _('GitLab is a single application for the entire software development lifecycle. From project planning and source code management to CI/CD, monitoring, and security.')
%p %p
= _('This is a self-managed instance of GitLab.') = _('This is a self-managed instance of GitLab.')
- if Gitlab::CurrentSettings.sign_in_text.present? - if Gitlab::CurrentSettings.sign_in_text.present?
= markdown_field(Gitlab::CurrentSettings.current_application_settings, :sign_in_text) = markdown_field(Gitlab::CurrentSettings.current_application_settings, :sign_in_text)
= render_if_exists 'layouts/devise_help_text' = render_if_exists 'layouts/devise_help_text'
.col-sm-5.order-1.order-sm-12.new-session-forms-container .col-sm-5.order-1.new-session-forms-container{ class: recently_confirmed_com? ? 'order-sm-first' : 'order-sm-12' }
= yield = yield
= render 'devise/shared/footer', footer_message: footer_message = render 'devise/shared/footer', footer_message: footer_message
...@@ -294,11 +294,6 @@ fieldset:disabled a.btn { ...@@ -294,11 +294,6 @@ fieldset:disabled a.btn {
.mb-3 { .mb-3 {
margin-bottom: 1rem !important; margin-bottom: 1rem !important;
} }
@media (min-width: 576px) {
.mt-sm-0 {
margin-top: 0 !important;
}
}
.text-center { .text-center {
text-align: center !important; text-align: center !important;
} }
...@@ -823,6 +818,11 @@ svg { ...@@ -823,6 +818,11 @@ svg {
.gl-mb-5 { .gl-mb-5 {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
@media (min-width: 36rem) {
.gl-sm-mt-0 {
margin-top: 0;
}
}
.gl-text-left { .gl-text-left {
text-align: left; text-align: left;
} }
......
...@@ -3,6 +3,42 @@ ...@@ -3,6 +3,42 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe SessionsHelper do RSpec.describe SessionsHelper do
describe '#recently_confirmed_com?' do
subject { helper.recently_confirmed_com? }
context 'when on .com' do
before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true)
end
it 'when flash notice is empty it is false' do
flash[:notice] = nil
expect(subject).to be false
end
it 'when flash notice is anything it is false' do
flash[:notice] = 'hooray!'
expect(subject).to be false
end
it 'when flash notice is devise confirmed message it is true' do
flash[:notice] = t(:confirmed, scope: [:devise, :confirmations])
expect(subject).to be true
end
end
context 'when not on .com' do
before do
allow(Gitlab).to receive(:dev_env_or_com?).and_return(false)
end
it 'when flash notice is devise confirmed message it is false' do
flash[:notice] = t(:confirmed, scope: [:devise, :confirmations])
expect(subject).to be false
end
end
end
describe '#unconfirmed_email?' do describe '#unconfirmed_email?' do
it 'returns true when the flash alert contains a devise failure unconfirmed message' do it 'returns true when the flash alert contains a devise failure unconfirmed message' do
flash[:alert] = t(:unconfirmed, scope: [:devise, :failure]) flash[:alert] = t(:unconfirmed, scope: [:devise, :failure])
......
...@@ -3,6 +3,32 @@ ...@@ -3,6 +3,32 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'devise/sessions/new' do RSpec.describe 'devise/sessions/new' do
describe 'marketing text' do
subject { render(template: 'devise/sessions/new', layout: 'layouts/devise') }
before do
stub_devise
disable_captcha
allow(Gitlab).to receive(:dev_env_or_com?).and_return(true)
end
it 'when flash is anything it renders marketing text' do
flash[:notice] = "You can't do that"
subject
expect(rendered).to have_content('A complete DevOps platform')
end
it 'when flash notice is devise confirmed message it hides marketing text' do
flash[:notice] = t(:confirmed, scope: [:devise, :confirmations])
subject
expect(rendered).not_to have_content('A complete DevOps platform')
end
end
describe 'ldap' do describe 'ldap' do
include LdapHelpers include LdapHelpers
......
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