Skip to content
Snippets Groups Projects
Verified Commit fa9dc29f authored by Eugie Limpin's avatar Eugie Limpin :two: Committed by GitLab
Browse files

Rename *identity_verification_path helpers to *signup_identity_verification_path

parent 5700be1d
No related branches found
No related tags found
1 merge request!147868Prefix identity_verification routes with signup
Showing
with 73 additions and 73 deletions
......@@ -73,7 +73,7 @@ def sign_in_and_redirect_or_verify_identity(user, auth_user, new_user)
session[:verification_user_id] = user.id
load_balancer_stick_request(::User, :user, user.id)
redirect_to identity_verification_path
redirect_to signup_identity_verification_path
end
override :set_session_active_since
......
......@@ -46,7 +46,7 @@ def restrict_registration
return if allow_invited_user?
member&.destroy
redirect_to restricted_identity_verification_path
redirect_to restricted_signup_identity_verification_path
end
def allow_invited_user?
......@@ -103,7 +103,7 @@ def identity_verification_enabled?
override :identity_verification_redirect_path
def identity_verification_redirect_path
identity_verification_path
signup_identity_verification_path
end
def send_custom_confirmation_instructions
......
......@@ -83,7 +83,7 @@ def complete_identity_verification
# When identity verification is enabled, store the user id in the session and redirect to the
# identity verification page instead of displaying a Devise flash alert on the sign in page.
session[:verification_user_id] = user.id
redirect_to identity_verification_path
redirect_to signup_identity_verification_path
end
end
end
......@@ -39,7 +39,7 @@ def exempt_user_from_phone_number_verification
return unless user.offer_phone_number_exemption?
user.create_phone_number_exemption!
Gitlab::EtagCaching::Store.new.touch(verification_state_identity_verification_path)
Gitlab::EtagCaching::Store.new.touch(verification_state_signup_identity_verification_path)
Gitlab::AppLogger.info(
message: 'Phone number verification exemption created',
......
......@@ -52,7 +52,7 @@ def resend_email_code
end
def success
return redirect_to identity_verification_path unless @user.identity_verified?
return redirect_to signup_identity_verification_path unless @user.identity_verified?
accept_pending_invitations(user: @user)
sign_in(@user)
......@@ -68,7 +68,7 @@ def success
private
def require_unverified_user!
redirect_to success_identity_verification_path if @user.identity_verified?
redirect_to success_signup_identity_verification_path if @user.identity_verified?
end
def require_arkose_verification!
......
......@@ -9,14 +9,14 @@ module IdentityVerificationHelper
def identity_verification_data(user)
{
data: {
verification_state_path: verification_state_identity_verification_path,
verification_state_path: verification_state_signup_identity_verification_path,
offer_phone_number_exemption: user.offer_phone_number_exemption?,
phone_exemption_path: toggle_phone_exemption_identity_verification_path,
phone_exemption_path: toggle_phone_exemption_signup_identity_verification_path,
credit_card: credit_card_verification_data(user),
phone_number: phone_number_verification_data(user),
email: email_verification_data(user),
arkose: arkose_labs_data,
successful_verification_path: success_identity_verification_path
successful_verification_path: success_signup_identity_verification_path
}.to_json
}
end
......@@ -74,15 +74,15 @@ def restricted_country?(country_code, namespace = nil)
def email_verification_data(user)
{
obfuscated: obfuscated_email(user.email),
verify_path: verify_email_code_identity_verification_path,
resend_path: resend_email_code_identity_verification_path
verify_path: verify_email_code_signup_identity_verification_path,
resend_path: resend_email_code_signup_identity_verification_path
}
end
def phone_number_verification_data(user)
data = {
send_code_path: send_phone_verification_code_identity_verification_path,
verify_code_path: verify_phone_verification_code_identity_verification_path,
send_code_path: send_phone_verification_code_signup_identity_verification_path,
verify_code_path: verify_phone_verification_code_signup_identity_verification_path,
enable_arkose_challenge: enable_arkose_challenge?(:phone).to_s,
show_arkose_challenge: show_arkose_challenge?(user, :phone).to_s,
show_recaptcha_challenge: show_recaptcha_challenge?.to_s
......@@ -105,8 +105,8 @@ def credit_card_verification_data(user)
{
user_id: user.id,
form_id: ::Gitlab::SubscriptionPortal::REGISTRATION_VALIDATION_FORM_ID,
verify_credit_card_path: verify_credit_card_identity_verification_path,
verify_captcha_path: verify_credit_card_captcha_identity_verification_path,
verify_credit_card_path: verify_credit_card_signup_identity_verification_path,
verify_captcha_path: verify_credit_card_captcha_signup_identity_verification_path,
show_recaptcha_challenge: show_recaptcha_challenge?.to_s
}
end
......
- page_title s_('IdentityVerification|Help us keep GitLab secure')
#js-arkose-labs-challenge{ data: arkose_labs_data.merge(session_verification_path: verify_arkose_labs_session_identity_verification_path) }
#js-arkose-labs-challenge{ data: arkose_labs_data.merge(session_verification_path: verify_arkose_labs_session_signup_identity_verification_path) }
# frozen_string_literal: true
scope :users, module: :users do
scope :users, module: :users, as: 'signup' do
resource :identity_verification, controller: :registrations_identity_verification, only: :show do
get :verification_state
post :verify_email_code
......
......@@ -202,7 +202,7 @@
oauth_request
expect(request.session[:verification_user_id]).not_to be_nil
expect(response).to redirect_to(identity_verification_path)
expect(response).to redirect_to(signup_identity_verification_path)
stick_object = request.env[::Gitlab::Database::LoadBalancing::RackMiddleware::STICK_OBJECT].first
expect(stick_object[0]).to eq(User.sticking)
......@@ -222,7 +222,7 @@
oauth_request
expect(request.session[:verification_user_id]).to be_nil
expect(response).not_to redirect_to(identity_verification_path)
expect(response).not_to redirect_to(signup_identity_verification_path)
end
end
......
......@@ -9,7 +9,7 @@
it 'does not redirect to the restricted identity verification path' do
subject
expect(response).not_to redirect_to restricted_identity_verification_path
expect(response).not_to redirect_to restricted_signup_identity_verification_path
end
end
......@@ -17,7 +17,7 @@
it 'redirects to the restricted identity verification path' do
subject
expect(response).to redirect_to restricted_identity_verification_path
expect(response).to redirect_to restricted_signup_identity_verification_path
end
end
......
......@@ -468,7 +468,7 @@ def stub_last_request_id(id)
post provider, params: { group_id: group }
expect(request.session[:verification_user_id]).to be_nil
expect(response).not_to redirect_to(identity_verification_path)
expect(response).not_to redirect_to(signup_identity_verification_path)
end
end
......
......@@ -169,7 +169,7 @@ def expect_successful_devise_confirmation
end
def expect_successful_custom_confirmation
expect(page).to have_current_path(identity_verification_path)
expect(page).to have_current_path(signup_identity_verification_path)
expect(page).to have_content(format(s_("IdentityVerification|For added security, you'll need to verify your "\
"identity. We've sent a verification code to %{email}"), email: obfuscated_email(user.email)))
......
......@@ -60,7 +60,7 @@ def send_request(session, method, path, headers:)
session.post user_session_path, params: { user: { login: new_user.username, password: new_user.password } }
# visit identity verification page
session.get identity_verification_path
session.get signup_identity_verification_path
# extract CSRF token
body = session.response.body
......@@ -69,9 +69,9 @@ def send_request(session, method, path, headers:)
headers = { 'X-CSRF-Token' => csrf_token }
phone_send_code_path = send_phone_verification_code_identity_verification_path
phone_verify_code_path = verify_phone_verification_code_identity_verification_path
credit_card_verify_path = verify_credit_card_identity_verification_path
phone_send_code_path = send_phone_verification_code_signup_identity_verification_path
phone_verify_code_path = verify_phone_verification_code_signup_identity_verification_path
credit_card_verify_path = verify_credit_card_signup_identity_verification_path
verification_endpoint_requests = {
phone: [
......
......@@ -33,7 +33,7 @@
end
context 'when in identity verification page' do
let(:page_path) { arkose_labs_challenge_identity_verification_path }
let(:page_path) { arkose_labs_challenge_signup_identity_verification_path }
before do
Warden.on_next_request do |proxy|
......
......@@ -214,33 +214,33 @@
def expected_data
{
verification_state_path: verification_state_identity_verification_path,
verification_state_path: verification_state_signup_identity_verification_path,
offer_phone_number_exemption: mock_offer_phone_number_exemption,
phone_exemption_path: toggle_phone_exemption_identity_verification_path,
phone_exemption_path: toggle_phone_exemption_signup_identity_verification_path,
credit_card: {
user_id: user.id,
form_id: ::Gitlab::SubscriptionPortal::REGISTRATION_VALIDATION_FORM_ID,
verify_credit_card_path: verify_credit_card_identity_verification_path,
verify_captcha_path: verify_credit_card_captcha_identity_verification_path,
verify_credit_card_path: verify_credit_card_signup_identity_verification_path,
verify_captcha_path: verify_credit_card_captcha_signup_identity_verification_path,
show_recaptcha_challenge: 'false'
},
phone_number: {
send_code_path: send_phone_verification_code_identity_verification_path,
verify_code_path: verify_phone_verification_code_identity_verification_path,
send_code_path: send_phone_verification_code_signup_identity_verification_path,
verify_code_path: verify_phone_verification_code_signup_identity_verification_path,
enable_arkose_challenge: 'false',
show_arkose_challenge: 'false',
show_recaptcha_challenge: 'false'
},
email: {
obfuscated: helper.obfuscated_email(user.email),
verify_path: verify_email_code_identity_verification_path,
resend_path: resend_email_code_identity_verification_path
verify_path: verify_email_code_signup_identity_verification_path,
resend_path: resend_email_code_signup_identity_verification_path
},
arkose: {
api_key: 'api-key',
domain: 'domain'
},
successful_verification_path: success_identity_verification_path
successful_verification_path: success_signup_identity_verification_path
}
end
end
......
......@@ -150,10 +150,10 @@
end
describe 'redirection' do
it 'redirects to the `identity_verification_path`' do
it 'redirects to the `signup_identity_verification_path`' do
create_user
expect(response).to redirect_to(identity_verification_path)
expect(response).to redirect_to(signup_identity_verification_path)
end
end
......
......@@ -41,8 +41,8 @@
end
context 'when origin country of user is blocked in Telesign' do
shared_examples 'does not invalidate verification_state_identity_verification_path cache' do
it 'does not invalidate verification_state_identity_verification_path cache' do
shared_examples 'does not invalidate verification_state_signup_identity_verification_path cache' do
it 'does not invalidate verification_state_signup_identity_verification_path cache' do
expect(Gitlab::EtagCaching).not_to receive(:new)
do_request
......@@ -81,7 +81,7 @@
context 'when no user is associated with the callback' do
let(:user) { nil }
it_behaves_like 'does not invalidate verification_state_identity_verification_path cache'
it_behaves_like 'does not invalidate verification_state_signup_identity_verification_path cache'
it_behaves_like 'does not log the event'
end
......@@ -97,9 +97,9 @@
expect { do_request }.to change { user.exempt_from_phone_number_verification? }.from(false).to(true)
end
it 'invalidates verification_state_identity_verification_path cache' do
it 'invalidates verification_state_signup_identity_verification_path cache' do
expect_next_instance_of(Gitlab::EtagCaching::Store) do |store|
expect(store).to receive(:touch).with(verification_state_identity_verification_path)
expect(store).to receive(:touch).with(verification_state_signup_identity_verification_path)
end
do_request
......@@ -121,7 +121,7 @@
end
it_behaves_like 'does not exempt the user'
it_behaves_like 'does not invalidate verification_state_identity_verification_path cache'
it_behaves_like 'does not invalidate verification_state_signup_identity_verification_path cache'
it_behaves_like 'does not log the event'
end
......@@ -131,7 +131,7 @@
end
it_behaves_like 'does not exempt the user'
it_behaves_like 'does not invalidate verification_state_identity_verification_path cache'
it_behaves_like 'does not invalidate verification_state_signup_identity_verification_path cache'
it_behaves_like 'does not log the event'
end
end
......
......@@ -33,7 +33,7 @@
end
end
it { is_expected.to redirect_to(identity_verification_path) }
it { is_expected.to redirect_to(signup_identity_verification_path) }
it 'sets the `verification_user_id` session variable' do
sign_in
......@@ -64,7 +64,7 @@
allow(Gitlab::Qa).to receive(:request?).and_return(true)
end
it { is_expected.not_to redirect_to(identity_verification_path) }
it { is_expected.not_to redirect_to(signup_identity_verification_path) }
end
end
end
......
......@@ -126,7 +126,7 @@
context 'when session contains a `verification_user_id` from a confirmed user' do
let_it_be(:user) { confirmed_user }
it { is_expected.to redirect_to(success_identity_verification_path) }
it { is_expected.to redirect_to(success_signup_identity_verification_path) }
end
context 'when session contains a `verification_user_id` from an unconfirmed user' do
......@@ -172,18 +172,18 @@
subject { response }
it { is_expected.to redirect_to(arkose_labs_challenge_identity_verification_path) }
it { is_expected.to redirect_to(arkose_labs_challenge_signup_identity_verification_path) }
context 'when user has an arkose_risk_band' do
let(:user) { create(:omniauth_user, :unconfirmed, :low_risk) }
it { is_expected.not_to redirect_to(arkose_labs_challenge_identity_verification_path) }
it { is_expected.not_to redirect_to(arkose_labs_challenge_signup_identity_verification_path) }
end
context 'when arkose is disabled' do
let(:is_arkose_enabled) { false }
it { is_expected.not_to redirect_to(arkose_labs_challenge_identity_verification_path) }
it { is_expected.not_to redirect_to(arkose_labs_challenge_signup_identity_verification_path) }
end
end
......@@ -442,7 +442,7 @@
end
describe 'GET show' do
subject(:do_request) { get identity_verification_path }
subject(:do_request) { get signup_identity_verification_path }
it_behaves_like 'it requires a valid verification_user_id'
it_behaves_like 'it requires an unconfirmed user'
......@@ -508,7 +508,7 @@
end
describe 'GET restricted' do
subject(:do_request) { get restricted_identity_verification_path }
subject(:do_request) { get restricted_signup_identity_verification_path }
it 'returns 404' do
do_request
......@@ -518,7 +518,7 @@
end
describe 'GET verification_state' do
subject(:do_request) { get verification_state_identity_verification_path }
subject(:do_request) { get verification_state_signup_identity_verification_path }
it_behaves_like 'it requires a valid verification_user_id'
......@@ -570,7 +570,7 @@
let_it_be(:params) { { registrations_identity_verification: { code: '123456' } } }
let_it_be(:service_response) { { status: :success } }
subject(:do_request) { post verify_email_code_identity_verification_path(params) }
subject(:do_request) { post verify_email_code_signup_identity_verification_path(params) }
before do
allow_next_instance_of(::Users::EmailVerification::ValidateTokenService) do |service|
......@@ -614,7 +614,7 @@
describe 'POST resend_email_code' do
let_it_be(:user) { unconfirmed_user }
subject(:do_request) { post resend_email_code_identity_verification_path }
subject(:do_request) { post resend_email_code_signup_identity_verification_path }
it_behaves_like 'it requires a valid verification_user_id'
it_behaves_like 'it requires an unconfirmed user'
......@@ -686,7 +686,7 @@
{ registrations_identity_verification: { country: 'US', international_dial_code: '1', phone_number: '555' } }
end
subject(:do_request) { post send_phone_verification_code_identity_verification_path(params) }
subject(:do_request) { post send_phone_verification_code_signup_identity_verification_path(params) }
before do
allow_next_instance_of(::PhoneVerification::Users::SendVerificationCodeService) do |service|
......@@ -745,7 +745,7 @@
{ registrations_identity_verification: { verification_code: '999' } }
end
subject(:do_request) { post verify_phone_verification_code_identity_verification_path(params) }
subject(:do_request) { post verify_phone_verification_code_signup_identity_verification_path(params) }
before do
allow_next_instance_of(::PhoneVerification::Users::VerifyCodeService) do |service|
......@@ -819,7 +819,7 @@
let_it_be(:user) { create(:user, :unconfirmed) }
let(:params) { { arkose_labs_token: 'fake-token' } }
let(:do_request) { post verify_arkose_labs_session_identity_verification_path, params: params }
let(:do_request) { post verify_arkose_labs_session_signup_identity_verification_path, params: params }
let(:service_response) { successful_verification_response }
before do
......@@ -857,7 +857,7 @@
it 'marks the user as Arkose-verified' do
expect { do_request }.to change { user.arkose_verified? }.from(false).to(true)
expect(response).to redirect_to(identity_verification_path)
expect(response).to redirect_to(signup_identity_verification_path)
end
end
end
......@@ -866,7 +866,7 @@
it 'redirects to show action' do
do_request
expect(response).to redirect_to(identity_verification_path)
expect(response).to redirect_to(signup_identity_verification_path)
end
describe 'phone verification service daily transaction limit check' do
......@@ -884,7 +884,7 @@
describe 'GET arkose_labs_challenge' do
let_it_be(:user) { create(:user, :unconfirmed) }
let(:do_request) { get arkose_labs_challenge_identity_verification_path }
let(:do_request) { get arkose_labs_challenge_signup_identity_verification_path }
it_behaves_like 'it requires a valid verification_user_id'
it_behaves_like 'it requires an unconfirmed user'
......@@ -910,14 +910,14 @@
let!(:member_invite) { create(:project_member, :invited, invite_email: user.email) }
before do
get success_identity_verification_path
get success_signup_identity_verification_path
end
context 'when not yet verified' do
let(:user) { unconfirmed_user }
it 'redirects back to identity_verification_path' do
expect(response).to redirect_to(identity_verification_path)
it 'redirects back to signup_identity_verification_path' do
expect(response).to redirect_to(signup_identity_verification_path)
end
end
......@@ -944,7 +944,7 @@
expect(experiment(:phone_verification_for_low_risk_users))
.to track(:registration_completed).on_next_instance.with_context(user: user)
get success_identity_verification_path
get success_signup_identity_verification_path
end
end
......@@ -952,7 +952,7 @@
before do
stub_saas_features(onboarding: true)
get success_identity_verification_path
get success_signup_identity_verification_path
end
context 'when it is an sso registration' do
......@@ -982,7 +982,7 @@
stub_session(verification_user_id: user.id)
end
subject(:do_request) { get verify_credit_card_identity_verification_path(params) }
subject(:do_request) { get verify_credit_card_signup_identity_verification_path(params) }
context 'when request format is html' do
let(:params) { { format: :html } }
......@@ -1109,7 +1109,7 @@
stub_session(verification_user_id: user.id)
end
subject(:do_request) { post verify_credit_card_captcha_identity_verification_path }
subject(:do_request) { post verify_credit_card_captcha_signup_identity_verification_path }
it_behaves_like 'it verifies reCAPTCHA response'
end
......@@ -1118,7 +1118,7 @@
let_it_be(:unconfirmed_user) { create(:user, :unconfirmed, :medium_risk) }
let_it_be(:user) { unconfirmed_user }
subject(:do_request) { patch toggle_phone_exemption_identity_verification_path(format: :json) }
subject(:do_request) { patch toggle_phone_exemption_signup_identity_verification_path(format: :json) }
before do
stub_session(verification_user_id: user.id)
......
......@@ -86,7 +86,7 @@ def expect_verification_completed
wait_for_requests
expect(page).to have_current_path(success_identity_verification_path)
expect(page).to have_current_path(success_signup_identity_verification_path)
expect(page).to have_content(s_('IdentityVerification|Verification successful'))
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment