Commit c8ad6097 authored by Nicolas Dular's avatar Nicolas Dular

Split sign in and sign up pages

Instead of having tabs to switch between sign in and sign up pages, we
want to have two separate pages. This separation was already part of an
experiment and is now the default experience.
parent d69dede9
@import 'mixins_and_variables_and_functions'; @import 'mixins_and_variables_and_functions';
.signup-page { .signup-page {
.page-wrap {
background-color: var(--gray-10, $gray-10);
}
.signup-box-container {
max-width: 960px;
}
.signup-box {
background-color: var(--white, $white);
box-shadow: 0 0 0 1px var(--border-color, $border-color);
border-radius: $border-radius;
}
.form-control {
&:active,
&:focus {
background-color: var(--white, $white);
}
}
.devise-errors { .devise-errors {
h2 { h2 {
font-size: $gl-font-size; font-size: $gl-font-size;
......
...@@ -14,15 +14,12 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -14,15 +14,12 @@ class RegistrationsController < Devise::RegistrationsController
prepend_before_action :check_captcha, only: :create prepend_before_action :check_captcha, only: :create
before_action :whitelist_query_limiting, :ensure_destroy_prerequisites_met, only: [:destroy] before_action :whitelist_query_limiting, :ensure_destroy_prerequisites_met, only: [:destroy]
before_action :load_recaptcha, only: :new before_action :load_recaptcha, only: :new
before_action :set_invite_params, only: :new
feature_category :authentication_and_authorization feature_category :authentication_and_authorization
def new def new
if experiment_enabled?(:signup_flow)
@resource = build_resource @resource = build_resource
else
redirect_to new_user_session_path(anchor: 'register-pane')
end
end end
def create def create
...@@ -206,8 +203,8 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -206,8 +203,8 @@ class RegistrationsController < Devise::RegistrationsController
# Part of an experiment to build a new sign up flow. Will be resolved # Part of an experiment to build a new sign up flow. Will be resolved
# with https://gitlab.com/gitlab-org/growth/engineering/issues/64 # with https://gitlab.com/gitlab-org/growth/engineering/issues/64
def choose_layout def choose_layout
if %w(welcome update_registration).include?(action_name) || experiment_enabled?(:signup_flow) if %w(welcome update_registration).include?(action_name)
'devise_experimental_separate_sign_up_flow' 'welcome'
else else
'devise' 'devise'
end end
...@@ -225,6 +222,10 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -225,6 +222,10 @@ class RegistrationsController < Devise::RegistrationsController
resource.state = BLOCKED_PENDING_APPROVAL_STATE resource.state = BLOCKED_PENDING_APPROVAL_STATE
end end
def set_invite_params
@invite_email = ActionController::Base.helpers.sanitize(params[:invite_email])
end
end end
RegistrationsController.prepend_if_ee('EE::RegistrationsController') RegistrationsController.prepend_if_ee('EE::RegistrationsController')
- page_title _("Sign up") - page_title _("Sign up")
- if experiment_enabled?(:signup_flow) - add_page_specific_style 'page_bundles/signup'
.row
.col-lg-7 .signup-page
%h1.mb-3.font-weight-bold.text-6.mt-0
= html_escape(_("Speed up your DevOps%{br_tag}with GitLab")) % { br_tag: '<br/>'.html_safe }
%p.text-3
= _("GitLab is a single application for the entire software development lifecycle. From project planning and source code management to CI/CD, monitoring, and security.")
.col-lg-5.order-12
.text-center.mb-3
%h2.font-weight-bold= _('Register for GitLab')
= render 'devise/shared/experimental_separate_sign_up_flow_box'
= render 'devise/shared/sign_in_link'
- else
= render 'devise/shared/signup_box' = render 'devise/shared/signup_box'
= render 'devise/shared/sign_in_link' = render 'devise/shared/sign_in_link'
...@@ -2,23 +2,21 @@ ...@@ -2,23 +2,21 @@
#signin-container #signin-container
- if any_form_based_providers_enabled? - if any_form_based_providers_enabled?
= render 'devise/shared/tabs_ldap' = render 'devise/shared/tabs_ldap', render_signup_link: false
- else
- unless experiment_enabled?(:signup_flow)
= render 'devise/shared/tabs_normal'
.tab-content .tab-content
- if password_authentication_enabled_for_web? || ldap_sign_in_enabled? || crowd_enabled? - if password_authentication_enabled_for_web? || ldap_sign_in_enabled? || crowd_enabled?
= render 'devise/shared/signin_box' = render 'devise/shared/signin_box'
-# Signup only makes sense if you can also sign-in
- if allow_signup?
= render 'devise/shared/signup_box'
-# Show a message if none of the mechanisms above are enabled -# Show a message if none of the mechanisms above are enabled
- if !password_authentication_enabled_for_web? && !ldap_sign_in_enabled? && !(omniauth_enabled? && devise_mapping.omniauthable?) - if !password_authentication_enabled_for_web? && !ldap_sign_in_enabled? && !(omniauth_enabled? && devise_mapping.omniauthable?)
%div %div
No authentication methods configured. No authentication methods configured.
- if allow_signup?
%p.gl-mt-3
= _("Don't have an account yet?")
= link_to _("Register now"), new_registration_path(:user, invite_email: @invite_email), data: { qa_selector: 'register_link' }
- if omniauth_enabled? && devise_mapping.omniauthable? && button_based_providers_enabled? - if omniauth_enabled? && devise_mapping.omniauthable? && button_based_providers_enabled?
.clearfix .clearfix
= render 'devise/shared/omniauth_box' = render 'devise/shared/omniauth_box'
- max_first_name_length = max_last_name_length = 127
- max_username_length = 255
- min_username_length = 2
.signup-box.p-3.mb-2
.signup-body
= form_for(resource, as: "new_#{resource_name}", url: registration_path(resource_name), html: { class: "new_new_user gl-show-field-errors", "aria-live" => "assertive" }) do |f|
.devise-errors.mt-0
= render "devise/shared/error_messages", resource: resource
- if Feature.enabled?(:invisible_captcha)
= invisible_captcha
.name.form-row
.col.form-group
= f.label :first_name, _('First name'), for: 'new_user_first_name', class: 'label-bold'
= f.text_field :first_name, class: 'form-control top js-block-emoji js-validate-length', :data => { :max_length => max_first_name_length, :max_length_message => _("First name is too long (maximum is %{max_length} characters).") % { max_length: max_first_name_length }, :qa_selector => 'new_user_firstname_field' }, required: true, title: _("This field is required.")
.col.form-group
= f.label :last_name, _('Last name'), for: 'new_user_last_name', class: 'label-bold'
= f.text_field :last_name, class: "form-control top js-block-emoji js-validate-length", :data => { :max_length => max_last_name_length, :max_length_message => _("Last name is too long (maximum is %{max_length} characters).") % { max_length: max_last_name_length }, :qa_selector => 'new_user_lastname_field' }, required: true, title: _("This field is required.")
.username.form-group
= f.label :username, class: 'label-bold'
= f.text_field :username, class: "form-control middle js-block-emoji js-validate-length js-validate-username", :data => { :min_length => min_username_length, :min_length_message => s_("SignUp|Username is too short (minimum is %{min_length} characters).") % { min_length: min_username_length }, :max_length => max_username_length, :max_length_message => _("Username is too long (maximum is %{max_length} characters).") % { max_length: max_username_length }, :qa_selector => 'new_user_username_field' }, pattern: Gitlab::PathRegex::NAMESPACE_FORMAT_REGEX_JS, required: true, title: _("Please create a username with only alphanumeric characters.")
%p.validation-error.gl-field-error-ignore.field-validation.mt-1.hide.cred= _('Username is already taken.')
%p.validation-success.gl-field-error-ignore.field-validation.mt-1.hide.cgreen= _('Username is available.')
%p.validation-pending.gl-field-error-ignore.field-validation.mt-1.hide= _('Checking username availability...')
.form-group
= f.label :email, class: 'label-bold'
= f.email_field :email, class: "form-control middle", data: { qa_selector: 'new_user_email_field' }, required: true, title: _("Please provide a valid email address.")
.form-group.append-bottom-20#password-strength
= f.label :password, class: 'label-bold'
= f.password_field :password, class: "form-control bottom", data: { qa_selector: 'new_user_password_field' }, required: true, pattern: ".{#{@minimum_password_length},}", title: _("Minimum length is %{minimum_password_length} characters.") % { minimum_password_length: @minimum_password_length }
%p.gl-field-hint.text-secondary= _('Minimum length is %{minimum_password_length} characters') % { minimum_password_length: @minimum_password_length }
%div
- if show_recaptcha_sign_up?
= recaptcha_tags
.submit-container.mt-3
= f.submit _("Register"), class: "btn-register gl-button btn btn-block btn-success mb-0 p-2", data: { qa_selector: 'new_user_register_button' }
= render 'devise/shared/terms_of_service_notice'
- if omniauth_enabled? && button_based_providers_enabled?
= render 'devise/shared/experimental_separate_sign_up_flow_omniauth_box'
...@@ -22,8 +22,3 @@ ...@@ -22,8 +22,3 @@
.login-box.tab-pane.active{ id: 'login-pane', role: 'tabpanel' } .login-box.tab-pane.active{ id: 'login-pane', role: 'tabpanel' }
.login-body .login-body
= render 'devise/sessions/new_base' = render 'devise/sessions/new_base'
- if experiment_enabled?(:signup_flow)
%p.light.mt-2
= _("Don't have an account yet?")
= link_to _("Register now"), new_registration_path(:user)
- max_first_name_length = max_last_name_length = 127 - max_first_name_length = max_last_name_length = 127
- max_username_length = 255 - max_username_length = 255
- min_username_length = 2 - min_username_length = 2
#register-pane.tab-pane.login-box{ role: 'tabpanel' } .gl-mb-3.gl-p-4.gl-border-gray-100.gl-border-1.gl-border-solid.gl-rounded-base
.login-body
= form_for(resource, as: "new_#{resource_name}", url: registration_path(resource_name), html: { class: "new_new_user gl-show-field-errors", "aria-live" => "assertive" }) do |f| = form_for(resource, as: "new_#{resource_name}", url: registration_path(resource_name), html: { class: "new_new_user gl-show-field-errors", "aria-live" => "assertive" }) do |f|
.devise-errors .devise-errors
= render "devise/shared/error_messages", resource: resource = render "devise/shared/error_messages", resource: resource
...@@ -18,9 +17,9 @@ ...@@ -18,9 +17,9 @@
.username.form-group .username.form-group
= f.label :username, class: 'label-bold' = f.label :username, class: 'label-bold'
= f.text_field :username, class: "form-control middle js-block-emoji js-validate-length js-validate-username", :data => { :min_length => min_username_length, :min_length_message => s_("SignUp|Username is too short (minimum is %{min_length} characters).") % { min_length: min_username_length }, :max_length => max_username_length, :max_length_message => s_("SignUp|Username is too long (maximum is %{max_length} characters).") % { max_length: max_username_length }, :qa_selector => 'new_user_username_field' }, pattern: Gitlab::PathRegex::NAMESPACE_FORMAT_REGEX_JS, required: true, title: _("Please create a username with only alphanumeric characters.") = f.text_field :username, class: "form-control middle js-block-emoji js-validate-length js-validate-username", :data => { :min_length => min_username_length, :min_length_message => s_("SignUp|Username is too short (minimum is %{min_length} characters).") % { min_length: min_username_length }, :max_length => max_username_length, :max_length_message => s_("SignUp|Username is too long (maximum is %{max_length} characters).") % { max_length: max_username_length }, :qa_selector => 'new_user_username_field' }, pattern: Gitlab::PathRegex::NAMESPACE_FORMAT_REGEX_JS, required: true, title: _("Please create a username with only alphanumeric characters.")
%p.validation-error.gl-field-error-ignore.field-validation.hide= _('Username is already taken.') %p.validation-error.gl-text-red-500.gl-field-error-ignore.gl-mt-2.field-validation.hide= _('Username is already taken.')
%p.validation-success.gl-field-error-ignore.field-validation.hide= _('Username is available.') %p.validation-success.gl-text-green-600.gl-field-error-ignore.gl-mt-2.field-validation.hide= _('Username is available.')
%p.validation-pending.gl-field-error-ignore.field-validation.hide= _('Checking username availability...') %p.validation-pending.gl-field-error-ignore.gl-mt-2.field-validation.hide= _('Checking username availability...')
.form-group .form-group
= f.label :email, class: 'label-bold' = f.label :email, class: 'label-bold'
= f.email_field :email, value: @invite_email, class: "form-control middle", data: { qa_selector: 'new_user_email_field' }, required: true, title: _("Please provide a valid email address.") = f.email_field :email, value: @invite_email, class: "form-control middle", data: { qa_selector: 'new_user_email_field' }, required: true, title: _("Please provide a valid email address.")
...@@ -32,5 +31,8 @@ ...@@ -32,5 +31,8 @@
- if show_recaptcha_sign_up? - if show_recaptcha_sign_up?
= recaptcha_tags = recaptcha_tags
.submit-container .submit-container
= f.submit _("Register"), class: "btn-register btn", data: { qa_selector: 'new_user_register_button' } = f.submit _("Register"), class: "btn gl-button btn-success", data: { qa_selector: 'new_user_register_button' }
= render 'devise/shared/terms_of_service_notice' = render 'devise/shared/terms_of_service_notice'
- if omniauth_enabled? && button_based_providers_enabled?
= render 'devise/shared/signup_omniauth_providers'
- page_description brand_title unless page_description - page_description brand_title unless page_description
-# Needs a redirect on the client side since it's using an anchor to distinguish
-# between sign in and registration. We need to inline the JS to not render
-# anything from this page beforehand.
-# Part of an experiment to build a new sign up flow. Will be removed again with
-# https://gitlab.com/gitlab-org/growth/engineering/issues/64
- if experiment_enabled?(:signup_flow) && current_path?("sessions#new")
= javascript_tag nonce: true do
:plain
if (window.location.hash === '#register-pane') {
window.location.replace("/users/sign_up")
}
- site_name = "GitLab" - site_name = "GitLab"
%head{ prefix: "og: http://ogp.me/ns#" } %head{ prefix: "og: http://ogp.me/ns#" }
%meta{ charset: "utf-8" } %meta{ charset: "utf-8" }
......
!!! 5 !!! 5
%html.devise-layout-html.navless{ class: system_message_class } %html.devise-layout-html.navless{ class: system_message_class }
- add_page_specific_style 'page_bundles/experimental_separate_sign_up' - add_page_specific_style 'page_bundles/signup'
= render "layouts/head" = render "layouts/head"
%body.ui-indigo.signup-page{ class: "#{client_class_list}", data: { page: body_data_page, qa_selector: 'signup_page' } } %body.ui-indigo.signup-page{ class: "#{client_class_list}", data: { page: body_data_page, qa_selector: 'signup_page' } }
= render "layouts/header/logo_with_title" = render "layouts/header/logo_with_title"
......
!!! 5
%html.devise-layout-html.navless{ class: system_message_class }
- add_page_specific_style 'page_bundles/experimental_separate_sign_up'
= render "layouts/head"
%body.ui-indigo.signup-page{ class: "#{client_class_list}", data: { page: body_data_page, qa_selector: 'signup_page' } }
= render "layouts/header/logo_with_title"
= render "layouts/init_client_detection_flags"
.page-wrap
.container.signup-box-container.navless-container
= render "layouts/broadcast"
.content
= render "layouts/flash"
= yield
%hr.footer-fixed
.footer-container
.container
.footer-links
= link_to _("Help"), help_path
= link_to _("About GitLab"), "https://about.gitlab.com/"
= footer_message
!!! 5
%html.subscriptions-layout-html{ lang: 'en' }
= render 'layouts/head'
%body.ui-indigo.d-flex.vh-100.gl-bg-gray-10
= render "layouts/header/logo_with_title"
= render "layouts/broadcast"
.container.d-flex.flex-grow-1.m-0
= yield
- page_title _('Your profile') - page_title _('Your profile')
.row.gl-flex-grow-1.gl-bg-gray-10 .row.gl-flex-grow-1
.d-flex.gl-flex-direction-column.gl-align-items-center.gl-w-full.gl-p-5 .d-flex.gl-flex-direction-column.gl-align-items-center.gl-w-full.gl-p-5
.edit-profile.login-page.d-flex.flex-column.gl-align-items-center.pt-lg-3 .edit-profile.login-page.d-flex.flex-column.gl-align-items-center.pt-lg-3
= render_if_exists "registrations/welcome/progress_bar" = render_if_exists "registrations/welcome/progress_bar"
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
= render "shared/notes/form", view: diff_view, supports_autocomplete: autocomplete = render "shared/notes/form", view: diff_view, supports_autocomplete: autocomplete
- elsif !current_user - elsif !current_user
.disabled-comment.text-center.gl-mt-3 .disabled-comment.text-center.gl-mt-3
- link_to_register = link_to(_("register"), new_session_path(:user, redirect_to_referer: 'yes', anchor: 'register-pane'), class: 'js-register-link') - link_to_register = link_to(_("register"), new_user_registration_path(redirect_to_referer: 'yes'), class: 'js-register-link')
- link_to_sign_in = link_to(_("sign in"), new_session_path(:user, redirect_to_referer: 'yes'), class: 'js-sign-in-link') - link_to_sign_in = link_to(_("sign in"), new_session_path(:user, redirect_to_referer: 'yes'), class: 'js-sign-in-link')
= _("Please %{link_to_register} or %{link_to_sign_in} to comment").html_safe % { link_to_register: link_to_register, link_to_sign_in: link_to_sign_in } = _("Please %{link_to_register} or %{link_to_sign_in} to comment").html_safe % { link_to_register: link_to_register, link_to_sign_in: link_to_sign_in }
- elsif discussion_locked - elsif discussion_locked
......
---
title: Split sign in and sign up pages
merge_request: 42592
author:
type: changed
...@@ -183,7 +183,7 @@ module Gitlab ...@@ -183,7 +183,7 @@ module Gitlab
config.assets.precompile << "page_bundles/environments.css" config.assets.precompile << "page_bundles/environments.css"
config.assets.precompile << "page_bundles/error_tracking_details.css" config.assets.precompile << "page_bundles/error_tracking_details.css"
config.assets.precompile << "page_bundles/error_tracking_index.css" config.assets.precompile << "page_bundles/error_tracking_index.css"
config.assets.precompile << "page_bundles/experimental_separate_sign_up.css" config.assets.precompile << "page_bundles/signup.css"
config.assets.precompile << "page_bundles/ide.css" config.assets.precompile << "page_bundles/ide.css"
config.assets.precompile << "page_bundles/issues_list.css" config.assets.precompile << "page_bundles/issues_list.css"
config.assets.precompile << "page_bundles/jira_connect.css" config.assets.precompile << "page_bundles/jira_connect.css"
......
...@@ -57,7 +57,7 @@ To subscribe to GitLab.com: ...@@ -57,7 +57,7 @@ To subscribe to GitLab.com:
- **For individuals**: - **For individuals**:
1. Create a user account for yourself using our 1. Create a user account for yourself using our
[sign up page](https://gitlab.com/users/sign_in#register-pane). [sign up page](https://gitlab.com/users/sign_up).
1. Visit the [billing page](https://gitlab.com/profile/billings) 1. Visit the [billing page](https://gitlab.com/profile/billings)
under your profile. under your profile.
1. Select the **Bronze**, **Silver**, or **Gold** GitLab.com plan through the 1. Select the **Bronze**, **Silver**, or **Gold** GitLab.com plan through the
...@@ -70,7 +70,7 @@ To subscribe to GitLab.com: ...@@ -70,7 +70,7 @@ To subscribe to GitLab.com:
1. Proceed to checkout. 1. Proceed to checkout.
- **For groups**: - **For groups**:
1. Create a user account for yourself using our 1. Create a user account for yourself using our
[sign up page](https://gitlab.com/users/sign_in#register-pane). [sign up page](https://gitlab.com/users/sign_up).
1. Create a [group](../../user/group/index.md). GitLab groups help assemble related 1. Create a [group](../../user/group/index.md). GitLab groups help assemble related
projects together allowing you to grant members access to several projects projects together allowing you to grant members access to several projects
at once. A group is not required if you plan on having projects inside a personal at once. A group is not required if you plan on having projects inside a personal
......
...@@ -14,9 +14,9 @@ You can create users: ...@@ -14,9 +14,9 @@ You can create users:
## Create users on sign in page ## Create users on sign in page
If you have [sign-up enabled](../../admin_area/settings/sign_up_restrictions.md), users can create their own accounts using the **Register** tab on the sign in page. If you have [sign-up enabled](../../admin_area/settings/sign_up_restrictions.md), users can create their own accounts by selecting "Register now" on the sign-in page, or navigate to `https://gitlab.example.com/users/sign_up`.
![Register Tab](img/register_tab.png) ![Register Tab](img/register_v13_6.png)
## Create users in Admin Area ## Create users in Admin Area
......
...@@ -27,15 +27,5 @@ module EE ...@@ -27,15 +27,5 @@ module EE
clean_params clean_params
end end
# Part of an experiment to build a new sign up flow. Will be resolved
# with https://gitlab.com/gitlab-org/growth/engineering/issues/64
def choose_layout
if %w(welcome update_registration).include?(action_name)
'checkout'
else
super
end
end
end end
end end
...@@ -20,18 +20,6 @@ RSpec.describe RegistrationsController do ...@@ -20,18 +20,6 @@ RSpec.describe RegistrationsController do
end end
end end
describe '#welcome' do
subject { get :welcome }
before do
sign_in(user)
end
it 'renders the checkout layout' do
expect(subject).to render_template(:checkout)
end
end
describe '#update_registration' do describe '#update_registration' do
let(:setup_for_company) { 'false' } let(:setup_for_company) { 'false' }
let(:email_opted_in) { '0' } let(:email_opted_in) { '0' }
......
...@@ -13,6 +13,7 @@ RSpec.describe 'Group or Project invitations' do ...@@ -13,6 +13,7 @@ RSpec.describe 'Group or Project invitations' do
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com)
visit invite_path(group_invite.raw_invite_token) visit invite_path(group_invite.raw_invite_token)
click_link 'Register now'
end end
def fill_in_sign_up_form(user) def fill_in_sign_up_form(user)
......
...@@ -16,12 +16,11 @@ RSpec.describe 'Signup on EE' do ...@@ -16,12 +16,11 @@ RSpec.describe 'Signup on EE' do
context 'for Gitlab.com' do context 'for Gitlab.com' do
before do before do
expect(Gitlab).to receive(:com?).and_return(true).at_least(:once) expect(Gitlab).to receive(:com?).and_return(true).at_least(:once)
visit new_user_registration_path
end end
context 'when the user sets it up for the company' do context 'when the user sets it up for the company' do
it 'creates the user and sets the email_opted_in field truthy' do it 'creates the user and sets the email_opted_in field truthy' do
visit root_path
fill_in_signup_form fill_in_signup_form
click_button "Register" click_button "Register"
...@@ -39,8 +38,6 @@ RSpec.describe 'Signup on EE' do ...@@ -39,8 +38,6 @@ RSpec.describe 'Signup on EE' do
context 'when the user checks the opt-in to email updates box' do context 'when the user checks the opt-in to email updates box' do
it 'creates the user and sets the email_opted_in field truthy' do it 'creates the user and sets the email_opted_in field truthy' do
visit root_path
fill_in_signup_form fill_in_signup_form
click_button "Register" click_button "Register"
...@@ -59,8 +56,6 @@ RSpec.describe 'Signup on EE' do ...@@ -59,8 +56,6 @@ RSpec.describe 'Signup on EE' do
context 'when the user does not check the opt-in to email updates box' do context 'when the user does not check the opt-in to email updates box' do
it 'creates the user and sets the email_opted_in field falsey' do it 'creates the user and sets the email_opted_in field falsey' do
visit root_path
fill_in_signup_form fill_in_signup_form
click_button "Register" click_button "Register"
...@@ -77,8 +72,6 @@ RSpec.describe 'Signup on EE' do ...@@ -77,8 +72,6 @@ RSpec.describe 'Signup on EE' do
end end
it 'redirects to step 2 of the signup process, sets the role and setup for company and redirects back' do it 'redirects to step 2 of the signup process, sets the role and setup for company and redirects back' do
visit new_user_registration_path
fill_in_signup_form fill_in_signup_form
click_button 'Register' click_button 'Register'
visit new_project_path visit new_project_path
...@@ -99,11 +92,10 @@ RSpec.describe 'Signup on EE' do ...@@ -99,11 +92,10 @@ RSpec.describe 'Signup on EE' do
context 'not for Gitlab.com' do context 'not for Gitlab.com' do
before do before do
expect(Gitlab).to receive(:com?).and_return(false).at_least(:once) expect(Gitlab).to receive(:com?).and_return(false).at_least(:once)
visit new_user_registration_path
end end
it 'does not have a opt-in checkbox, it creates the user and sets email_opted_in to falsey' do it 'does not have a opt-in checkbox, it creates the user and sets email_opted_in to falsey' do
visit root_path
expect(page).not_to have_selector("[name='new_user_email_opted_in']") expect(page).not_to have_selector("[name='new_user_email_opted_in']")
fill_in_signup_form fill_in_signup_form
......
...@@ -55,10 +55,16 @@ RSpec.describe 'Login' do ...@@ -55,10 +55,16 @@ RSpec.describe 'Login' do
stub_licensed_features(smartcard_auth: false) stub_licensed_features(smartcard_auth: false)
end end
it 'correctly renders tabs and panes' do it 'does not render any tabs' do
subject subject
ensure_tab_pane_correctness(['Sign in', 'Register']) ensure_no_tabs
end
it 'renders link to sign up path' do
visit new_user_session_path
expect(page.body).to have_link('Register now', href: new_user_registration_path)
end end
end end
...@@ -70,7 +76,13 @@ RSpec.describe 'Login' do ...@@ -70,7 +76,13 @@ RSpec.describe 'Login' do
it 'correctly renders tabs and panes' do it 'correctly renders tabs and panes' do
subject subject
ensure_tab_pane_correctness(%w(Smartcard Standard Register)) ensure_tab_pane_correctness(%w(Smartcard Standard))
end
it 'renders link to sign up path' do
visit new_user_session_path
expect(page.body).to have_link('Register now', href: new_user_registration_path)
end end
describe 'with two-factor authentication required', :clean_gitlab_redis_shared_state do describe 'with two-factor authentication required', :clean_gitlab_redis_shared_state do
......
...@@ -22013,9 +22013,6 @@ msgstr "" ...@@ -22013,9 +22013,6 @@ msgstr ""
msgid "Register device" msgid "Register device"
msgstr "" msgstr ""
msgid "Register for GitLab"
msgstr ""
msgid "Register now" msgid "Register now"
msgstr "" msgstr ""
...@@ -25302,9 +25299,6 @@ msgstr "" ...@@ -25302,9 +25299,6 @@ msgstr ""
msgid "Specify the following URL during the Runner setup:" msgid "Specify the following URL during the Runner setup:"
msgstr "" msgstr ""
msgid "Speed up your DevOps%{br_tag}with GitLab"
msgstr ""
msgid "Squash commit message" msgid "Squash commit message"
msgstr "" msgstr ""
...@@ -29243,9 +29237,6 @@ msgstr "" ...@@ -29243,9 +29237,6 @@ msgstr ""
msgid "Username is available." msgid "Username is available."
msgstr "" msgstr ""
msgid "Username is too long (maximum is %{max_length} characters)."
msgstr ""
msgid "Username or email" msgid "Username or email"
msgstr "" msgstr ""
......
...@@ -125,9 +125,9 @@ module QA ...@@ -125,9 +125,9 @@ module QA
click_element :sign_in_tab click_element :sign_in_tab
end end
def switch_to_register_tab def switch_to_register_page
set_initial_password_if_present set_initial_password_if_present
click_element :register_tab click_element :register_link
end end
def switch_to_ldap_tab def switch_to_ldap_tab
......
...@@ -75,7 +75,7 @@ module QA ...@@ -75,7 +75,7 @@ module QA
end end
else else
Page::Main::Login.perform do |login| Page::Main::Login.perform do |login|
login.switch_to_register_tab login.switch_to_register_page
end end
Page::Main::SignUp.perform do |signup| Page::Main::SignUp.perform do |signup|
signup.sign_up!(self) signup.sign_up!(self)
......
...@@ -12,12 +12,6 @@ RSpec.describe RegistrationsController do ...@@ -12,12 +12,6 @@ RSpec.describe RegistrationsController do
describe '#new' do describe '#new' do
subject { get :new } subject { get :new }
context 'with the experimental signup flow enabled and the user is part of the experimental group' do
before do
stub_experiment(signup_flow: true)
stub_experiment_for_user(signup_flow: true)
end
it 'renders new template and sets the resource variable' do it 'renders new template and sets the resource variable' do
expect(subject).to render_template(:new) expect(subject).to render_template(:new)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
...@@ -25,20 +19,6 @@ RSpec.describe RegistrationsController do ...@@ -25,20 +19,6 @@ RSpec.describe RegistrationsController do
end end
end end
context 'with the experimental signup flow enabled and the user is part of the control group' do
before do
stub_experiment(signup_flow: true)
stub_experiment_for_user(signup_flow: false)
end
it 'renders new template and sets the resource variable' do
subject
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(new_user_session_path(anchor: 'register-pane'))
end
end
end
describe '#create' do describe '#create' do
let(:base_user_params) { { first_name: 'first', last_name: 'last', username: 'new_username', email: 'new@user.com', password: 'Any_password' } } let(:base_user_params) { { first_name: 'first', last_name: 'last', username: 'new_username', email: 'new@user.com', password: 'Any_password' } }
let(:user_params) { { user: base_user_params } } let(:user_params) { { user: base_user_params } }
...@@ -426,12 +406,10 @@ RSpec.describe RegistrationsController do ...@@ -426,12 +406,10 @@ RSpec.describe RegistrationsController do
describe '#welcome' do describe '#welcome' do
subject { get :welcome } subject { get :welcome }
it 'renders the devise_experimental_separate_sign_up_flow layout' do it 'renders the welcome layout' do
sign_in(create(:user)) sign_in(create(:user))
expected_layout = Gitlab.ee? ? :checkout : :devise_experimental_separate_sign_up_flow expect(subject).to render_template(:welcome)
expect(subject).to render_template(expected_layout)
end end
context '2FA is required from group' do context '2FA is required from group' do
......
...@@ -58,6 +58,8 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -58,6 +58,8 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end end
it 'pre-fills the Email field on the sign up box with the invite_email from the invite' do it 'pre-fills the Email field on the sign up box with the invite_email from the invite' do
click_link 'Register now'
expect(find_field('Email').value).to eq(group_invite.invite_email) expect(find_field('Email').value).to eq(group_invite.invite_email)
end end
...@@ -92,6 +94,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -92,6 +94,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
before do before do
stub_application_setting(send_user_confirmation_email: send_email_confirmation) stub_application_setting(send_user_confirmation_email: send_email_confirmation)
visit invite_path(group_invite.raw_invite_token) visit invite_path(group_invite.raw_invite_token)
click_link 'Register now'
end end
context 'email confirmation disabled' do context 'email confirmation disabled' do
......
...@@ -26,7 +26,6 @@ RSpec.describe 'Login' do ...@@ -26,7 +26,6 @@ RSpec.describe 'Login' do
user.reload user.reload
expect(user.reset_password_token).not_to be_nil expect(user.reset_password_token).not_to be_nil
find('a[href="#login-pane"]').click
gitlab_sign_in(user) gitlab_sign_in(user)
expect(current_path).to eq root_path expect(current_path).to eq root_path
...@@ -593,10 +592,16 @@ RSpec.describe 'Login' do ...@@ -593,10 +592,16 @@ RSpec.describe 'Login' do
describe 'UI tabs and panes' do describe 'UI tabs and panes' do
context 'when no defaults are changed' do context 'when no defaults are changed' do
it 'correctly renders tabs and panes' do it 'does not render any tabs' do
visit new_user_session_path
ensure_no_tabs
end
it 'renders link to sign up path' do
visit new_user_session_path visit new_user_session_path
ensure_tab_pane_correctness(['Sign in', 'Register']) expect(page.body).to have_link('Register now', href: new_user_registration_path)
end end
end end
...@@ -607,8 +612,14 @@ RSpec.describe 'Login' do ...@@ -607,8 +612,14 @@ RSpec.describe 'Login' do
visit new_user_session_path visit new_user_session_path
end end
it 'correctly renders tabs and panes' do it 'does not render any tabs' do
ensure_tab_pane_correctness(['Sign in']) ensure_no_tabs
end
it 'does not render link to sign up path' do
visit new_user_session_path
expect(page.body).not_to have_link('Register now', href: new_user_registration_path)
end end
end end
...@@ -644,7 +655,11 @@ RSpec.describe 'Login' do ...@@ -644,7 +655,11 @@ RSpec.describe 'Login' do
end end
it 'correctly renders tabs and panes' do it 'correctly renders tabs and panes' do
ensure_tab_pane_correctness(['Main LDAP', 'Standard', 'Register']) ensure_tab_pane_correctness(['Main LDAP', 'Standard'])
end
it 'renders link to sign up path' do
expect(page.body).to have_link('Register now', href: new_user_registration_path)
end end
end end
...@@ -665,7 +680,7 @@ RSpec.describe 'Login' do ...@@ -665,7 +680,7 @@ RSpec.describe 'Login' do
end end
it 'correctly renders tabs and panes' do it 'correctly renders tabs and panes' do
ensure_tab_pane_correctness(%w(Crowd Standard Register)) ensure_tab_pane_correctness(%w(Crowd Standard))
end end
end end
end end
......
...@@ -2,7 +2,45 @@ ...@@ -2,7 +2,45 @@
require 'spec_helper' require 'spec_helper'
RSpec.shared_examples 'Signup' do RSpec.shared_examples 'Signup name validation' do |field, max_length, label|
before do
visit new_user_registration_path
end
describe "#{field} validation", :js do
it "does not show an error border if the user's fullname length is not longer than #{max_length} characters" do
fill_in field, with: 'u' * max_length
expect(find('.name')).not_to have_css '.gl-field-error-outline'
end
it 'shows an error border if the user\'s fullname contains an emoji' do
simulate_input("##{field}", 'Ehsan 🦋')
expect(find('.name')).to have_css '.gl-field-error-outline'
end
it "shows an error border if the user\'s fullname is longer than #{max_length} characters" do
fill_in field, with: 'n' * (max_length + 1)
expect(find('.name')).to have_css '.gl-field-error-outline'
end
it "shows an error message if the user\'s #{label} is longer than #{max_length} characters" do
fill_in field, with: 'n' * (max_length + 1)
expect(page).to have_content("#{label} is too long (maximum is #{max_length} characters).")
end
it 'shows an error message if the username contains emojis' do
simulate_input("##{field}", 'Ehsan 🦋')
expect(page).to have_content("Invalid input, please avoid emojis")
end
end
end
RSpec.describe 'Signup' do
include TermsHelper include TermsHelper
let(:new_user) { build_stubbed(:user) } let(:new_user) { build_stubbed(:user) }
...@@ -295,64 +333,7 @@ RSpec.shared_examples 'Signup' do ...@@ -295,64 +333,7 @@ RSpec.shared_examples 'Signup' do
expect(created_user.setup_for_company).to be_nil expect(created_user.setup_for_company).to be_nil
expect(page).to have_current_path(new_project_path) expect(page).to have_current_path(new_project_path)
end end
end
RSpec.shared_examples 'Signup name validation' do |field, max_length, label|
before do
visit new_user_registration_path
end
describe "#{field} validation", :js do
it "does not show an error border if the user's fullname length is not longer than #{max_length} characters" do
fill_in field, with: 'u' * max_length
expect(find('.name')).not_to have_css '.gl-field-error-outline'
end
it 'shows an error border if the user\'s fullname contains an emoji' do
simulate_input("##{field}", 'Ehsan 🦋')
expect(find('.name')).to have_css '.gl-field-error-outline'
end
it "shows an error border if the user\'s fullname is longer than #{max_length} characters" do
fill_in field, with: 'n' * (max_length + 1)
expect(find('.name')).to have_css '.gl-field-error-outline'
end
it "shows an error message if the user\'s #{label} is longer than #{max_length} characters" do
fill_in field, with: 'n' * (max_length + 1)
expect(page).to have_content("#{label} is too long (maximum is #{max_length} characters).")
end
it 'shows an error message if the username contains emojis' do
simulate_input("##{field}", 'Ehsan 🦋')
expect(page).to have_content("Invalid input, please avoid emojis")
end
end
end
RSpec.describe 'With original flow' do
before do
stub_experiment(signup_flow: false)
stub_experiment_for_user(signup_flow: false)
end
it_behaves_like 'Signup'
it_behaves_like 'Signup name validation', 'new_user_first_name', 127, 'First name'
it_behaves_like 'Signup name validation', 'new_user_last_name', 127, 'Last name'
end
RSpec.describe 'With experimental flow' do
before do
stub_experiment(signup_flow: true)
stub_experiment_for_user(signup_flow: true)
end
it_behaves_like 'Signup'
it_behaves_like 'Signup name validation', 'new_user_first_name', 127, 'First name' it_behaves_like 'Signup name validation', 'new_user_first_name', 127, 'First name'
it_behaves_like 'Signup name validation', 'new_user_last_name', 127, 'Last name' it_behaves_like 'Signup name validation', 'new_user_last_name', 127, 'Last name'
end end
...@@ -5,7 +5,4 @@ ...@@ -5,7 +5,4 @@
<li> <li>
<a href="#login-pane">Standard</a> <a href="#login-pane">Standard</a>
</li> </li>
<li>
<a href="#register-pane">Register</a>
</li>
</ul> </ul>
...@@ -7,7 +7,7 @@ export const notesDataMock = { ...@@ -7,7 +7,7 @@ export const notesDataMock = {
newSessionPath: '/users/sign_in?redirect_to_referer=yes', newSessionPath: '/users/sign_in?redirect_to_referer=yes',
notesPath: '/gitlab-org/gitlab-foss/noteable/issue/98/notes', notesPath: '/gitlab-org/gitlab-foss/noteable/issue/98/notes',
quickActionsDocsPath: '/help/user/project/quick_actions', quickActionsDocsPath: '/help/user/project/quick_actions',
registerPath: '/users/sign_in?redirect_to_referer=yes#register-pane', registerPath: '/users/sign_up?redirect_to_referer=yes',
prerenderedNotesCount: 1, prerenderedNotesCount: 1,
closePath: '/twitter/flight/issues/9.json?issue%5Bstate_event%5D=close', closePath: '/twitter/flight/issues/9.json?issue%5Bstate_event%5D=close',
reopenPath: '/twitter/flight/issues/9.json?issue%5Bstate_event%5D=reopen', reopenPath: '/twitter/flight/issues/9.json?issue%5Bstate_event%5D=reopen',
......
...@@ -14,18 +14,16 @@ describe('preserve_url_fragment', () => { ...@@ -14,18 +14,16 @@ describe('preserve_url_fragment', () => {
loadFixtures('sessions/new.html'); loadFixtures('sessions/new.html');
}); });
it('adds the url fragment to all login and sign up form actions', () => { it('adds the url fragment to the login form actions', () => {
preserveUrlFragment('#L65'); preserveUrlFragment('#L65');
expect($('#new_user').attr('action')).toBe('http://test.host/users/sign_in#L65'); expect($('#new_user').attr('action')).toBe('http://test.host/users/sign_in#L65');
expect($('#new_new_user').attr('action')).toBe('http://test.host/users#L65');
}); });
it('does not add an empty url fragment to login and sign up form actions', () => { it('does not add an empty url fragment to the login form actions', () => {
preserveUrlFragment(); preserveUrlFragment();
expect($('#new_user').attr('action')).toBe('http://test.host/users/sign_in'); expect($('#new_user').attr('action')).toBe('http://test.host/users/sign_in');
expect($('#new_new_user').attr('action')).toBe('http://test.host/users');
}); });
it('does not add an empty query parameter to OmniAuth login buttons', () => { it('does not add an empty query parameter to OmniAuth login buttons', () => {
......
...@@ -8,6 +8,10 @@ module UserLoginHelper ...@@ -8,6 +8,10 @@ module UserLoginHelper
ensure_one_active_pane ensure_one_active_pane
end end
def ensure_no_tabs
expect(page.all('[role="tab"]').size).to eq(0)
end
def ensure_tab_labels(tab_names) def ensure_tab_labels(tab_names)
tab_labels = page.all('[role="tab"]').map(&:text) tab_labels = page.all('[role="tab"]').map(&:text)
......
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