Commit 8c7d3a45 authored by Jay Swain's avatar Jay Swain

Simplify the sign in page after confirmation

After confirmation we're stripping away the "marketing content" on the
page to focus the user on signing in.

part of:
https://gitlab.com/gitlab-org/gitlab/-/issues/330341

Changelog: changed
parent 2fca139b
......@@ -294,11 +294,6 @@ fieldset:disabled a.btn {
.mb-3 {
margin-bottom: 1rem !important;
}
@media (min-width: 576px) {
.mt-sm-0 {
margin-top: 0 !important;
}
}
.text-center {
text-align: center !important;
}
......@@ -817,6 +812,11 @@ svg {
.gl-mb-5 {
margin-bottom: 1rem;
}
@media (min-width: 36rem) {
.gl-sm-mt-0 {
margin-top: 0;
}
}
.gl-text-left {
text-align: left;
}
......
# frozen_string_literal: true
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?
flash[:alert] == t(:unconfirmed, scope: [:devise, :failure])
end
......
......@@ -17,25 +17,26 @@
= current_appearance&.title.presence || "GitLab"
.row.mb-3
.col-sm-7.order-12.order-sm-1.brand-holder
= brand_image
- if current_appearance&.description?
= brand_text
- else
%h3.mt-sm-0
= _('A complete DevOps platform')
- unless recently_confirmed_com?
= brand_image
- if current_appearance&.description?
= brand_text
- else
%h3.gl-sm-mt-0
= _('A complete DevOps platform')
%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.')
%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.')
%p
= _('This is a self-managed instance of GitLab.')
%p
= _('This is a self-managed instance of GitLab.')
- if Gitlab::CurrentSettings.sign_in_text.present?
= markdown_field(Gitlab::CurrentSettings.current_application_settings, :sign_in_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
= render 'devise/shared/footer', footer_message: footer_message
......@@ -294,11 +294,6 @@ fieldset:disabled a.btn {
.mb-3 {
margin-bottom: 1rem !important;
}
@media (min-width: 576px) {
.mt-sm-0 {
margin-top: 0 !important;
}
}
.text-center {
text-align: center !important;
}
......@@ -817,6 +812,11 @@ svg {
.gl-mb-5 {
margin-bottom: 1rem;
}
@media (min-width: 36rem) {
.gl-sm-mt-0 {
margin-top: 0;
}
}
.gl-text-left {
text-align: left;
}
......
......@@ -3,6 +3,42 @@
require 'spec_helper'
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
it 'returns true when the flash alert contains a devise failure unconfirmed message' do
flash[:alert] = t(:unconfirmed, scope: [:devise, :failure])
......
......@@ -3,6 +3,32 @@
require 'spec_helper'
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
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