Commit ab957c80 authored by Jay Swain's avatar Jay Swain

Pre-fill user email address after confirming

This commit pre-fills the newly confirmed users email address on the
sign-in page.

part of:
https://gitlab.com/gitlab-org/gitlab/-/issues/324405
parent ec5edc5f
......@@ -27,7 +27,7 @@ class ConfirmationsController < Devise::ConfirmationsController
else
Gitlab::AppLogger.info("Email Confirmed: username=#{resource.username} email=#{resource.email} ip=#{request.remote_ip}")
flash[:notice] = flash[:notice] + _(" Please sign in.")
new_session_path(:user, anchor: 'login-pane')
new_session_path(:user, anchor: 'login-pane', invite_email: resource.email)
end
end
......
---
title: Pre-fill user email address after confirming
merge_request: 60179
author:
type: changed
......@@ -57,6 +57,12 @@ RSpec.describe 'Signup' do
fill_in 'new_user_password', with: new_user.password
end
def confirm_email
new_user_token = User.find_by_email(new_user.email).confirmation_token
visit user_confirmation_path(confirmation_token: new_user_token)
end
describe 'username validation', :js do
before do
visit new_user_registration_path
......@@ -191,7 +197,7 @@ RSpec.describe 'Signup' do
stub_feature_flags(soft_email_confirmation: false)
end
it 'creates the user account and sends a confirmation email' do
it 'creates the user account and sends a confirmation email, and pre-fills email address after confirming' do
visit new_user_registration_path
fill_in_signup_form
......@@ -199,6 +205,10 @@ RSpec.describe 'Signup' do
expect { click_button 'Register' }.to change { User.count }.by(1)
expect(current_path).to eq users_almost_there_path
expect(page).to have_content('Please check your email to confirm your account')
confirm_email
expect(find_field('Username or email').value).to eq(new_user.email)
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