Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/controllers/sign_up/email_confirmations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def clear_setup_piv_cac_from_sign_in
def process_successful_confirmation
process_valid_confirmation_token
request_id = params.fetch(:_request_id, '')
Funnel::Registration::ConfirmEmail.call(@user.id)
redirect_to sign_up_enter_password_url(
request_id: request_id, confirmation_token: @confirmation_token,
)
Expand Down
1 change: 0 additions & 1 deletion app/controllers/sign_up/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def process_successful_password_creation
).call
@user.email_addresses.take.update(confirmed_at: now)

Funnel::Registration::AddPassword.call(@user.id)
sign_in_and_redirect_user
end

Expand Down
1 change: 0 additions & 1 deletion app/forms/register_user_email_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def process_successful_submission(request_id, instructions)
self.success = true
user.accepted_terms_at = Time.zone.now
user.save!
Funnel::Registration::Create.call(user.id)
SendSignUpEmailConfirmation.new(user).call(
request_id: email_request_id(request_id),
instructions: instructions,
Expand Down
20 changes: 4 additions & 16 deletions app/services/funnel/registration/add_mfa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,11 @@ module Registration
class AddMfa
def self.call(user_id, mfa_method, analytics)
now = Time.zone.now
funnel = RegistrationLog.find_by(user_id: user_id)
return if funnel.blank? || funnel.second_mfa.present?
funnel = RegistrationLog.where(user_id: user_id).first_or_create(submitted_at: now)
return if funnel.registered_at.present?

if funnel.first_mfa.present?
params = {
second_mfa: mfa_method,
}
else
params = {
first_mfa: mfa_method,
first_mfa_at: now,
registered_at: now,
}
analytics.user_registration_user_fully_registered(mfa_method: mfa_method)
end

funnel.update!(params)
analytics.user_registration_user_fully_registered(mfa_method: mfa_method)
funnel.update!(registered_at: now)
end
end
end
Expand Down
11 changes: 0 additions & 11 deletions app/services/funnel/registration/add_password.rb

This file was deleted.

11 changes: 0 additions & 11 deletions app/services/funnel/registration/confirm_email.rb

This file was deleted.

11 changes: 0 additions & 11 deletions app/services/funnel/registration/create.rb

This file was deleted.

9 changes: 0 additions & 9 deletions app/services/funnel/registration/range_submitted_count.rb

This file was deleted.

9 changes: 0 additions & 9 deletions app/services/funnel/registration/total_submitted_count.rb

This file was deleted.

5 changes: 3 additions & 2 deletions spec/controllers/users/backup_code_setup_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

describe Users::BackupCodeSetupController do
it 'creates backup codes and logs expected events' do
user = build(:user, :signed_up)
user = create(:user, :signed_up)
stub_sign_in(user)
stub_analytics
analytics = stub_analytics
stub_attempts_tracker

Funnel::Registration::AddMfa.call(user.id, 'phone', analytics)
expect(PushNotification::HttpPush).to receive(:deliver).
with(PushNotification::RecoveryInformationChangedEvent.new(user: user))
expect(@analytics).to receive(:track_event).
Expand Down
5 changes: 2 additions & 3 deletions spec/controllers/users/webauthn_setup_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
end

it 'tracks the submission' do
Funnel::Registration::AddMfa.call(user.id, 'phone', @analytics)
result = {
enabled_mfa_methods_count: 3,
mfa_method_counts: {
Expand Down Expand Up @@ -196,6 +197,7 @@
}
end
it 'should log expected events' do
Funnel::Registration::AddMfa.call(user.id, 'phone', @analytics)
expect(@analytics).to receive(:track_event).with(
'Multi-Factor Authentication Setup',
{
Expand Down Expand Up @@ -277,10 +279,7 @@
:mfa_enroll_webauthn_platform, success: true
)

registration_log = Funnel::Registration::Create.call(user.id)
patch :confirm, params: params

expect(registration_log.reload.first_mfa).to eq 'webauthn_platform'
end
end

Expand Down
2 changes: 0 additions & 2 deletions spec/features/visitors/sign_up_with_email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
expect(page).to have_content t('notices.signed_up_but_unconfirmed.first_paragraph_start')
expect(page).to have_content t('notices.signed_up_but_unconfirmed.first_paragraph_end')
expect(page).to have_content email
expect(Funnel::Registration::TotalSubmittedCount.call).to eq(1)
expect(Funnel::Registration::TotalRegisteredCount.call).to eq(0)
end

Expand Down Expand Up @@ -54,7 +53,6 @@
visit sign_up_email_path
sign_up_and_2fa_ial1_user

expect(Funnel::Registration::TotalSubmittedCount.call).to eq(1)
expect(Funnel::Registration::TotalRegisteredCount.call).to eq(1)
expect(current_path).to eq account_path
end
Expand Down
27 changes: 5 additions & 22 deletions spec/services/funnel/registration/add_mfa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,17 @@

let(:user_id) do
user = create(:user)
user_id = user.id
Funnel::Registration::Create.call(user_id)
user_id
user.id
end
let(:funnel) { RegistrationLog.all.first }

it 'adds an 1st mfa' do
subject.call(user_id, 'phone', analytics)

expect(funnel.first_mfa).to eq('phone')
expect(funnel.first_mfa_at).to be_present
end

it 'adds a 2nd mfa' do
subject.call(user_id, 'phone', analytics)
subject.call(user_id, 'backup_codes', analytics)

expect(funnel.first_mfa).to eq('phone')
expect(funnel.first_mfa_at).to be_present
expect(funnel.second_mfa).to eq('backup_codes')
it 'shows user is not fully registered with no mfa' do
expect(funnel&.registered_at).to_not be_present
end

it 'does not add a 3rd mfa' do
it 'shows user is fully registered after adding an mfa' do
subject.call(user_id, 'phone', analytics)
subject.call(user_id, 'backup_codes', analytics)
subject.call(user_id, 'auth_app', analytics)

expect(funnel.first_mfa).to eq('phone')
expect(funnel.second_mfa).to eq('backup_codes')
expect(funnel.registered_at).to be_present
end
end
20 changes: 0 additions & 20 deletions spec/services/funnel/registration/add_password_spec.rb

This file was deleted.

20 changes: 0 additions & 20 deletions spec/services/funnel/registration/confirm_email_spec.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ def register_user(year, month, day)
travel_to Date.new(year, month, day) do
user = create(:user)
user_id = user.id
Funnel::Registration::Create.call(user_id)
Funnel::Registration::AddPassword.call(user_id)
Funnel::Registration::AddMfa.call(user_id, 'backup_codes', analytics)
end
end
Expand Down
57 changes: 0 additions & 57 deletions spec/services/funnel/registration/range_submitted_count_spec.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
it 'returns 0 until the user is fully registered' do
user = create(:user)
user_id = user.id
Funnel::Registration::Create.call(user_id)

expect(Funnel::Registration::TotalRegisteredCount.call).to eq(0)

Funnel::Registration::AddPassword.call(user_id)

expect(Funnel::Registration::TotalRegisteredCount.call).to eq(0)

Funnel::Registration::AddMfa.call(user_id, 'phone', analytics)
Expand All @@ -40,8 +36,6 @@
def register_user
user = create(:user)
user_id = user.id
Funnel::Registration::Create.call(user_id)
Funnel::Registration::AddPassword.call(user_id)
Funnel::Registration::AddMfa.call(user_id, 'backup_codes', analytics)
end
end
23 changes: 0 additions & 23 deletions spec/services/funnel/registration/total_submitted_count_spec.rb

This file was deleted.

1 change: 0 additions & 1 deletion spec/services/request_password_reset_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
).perform
user = User.find_with_email(email)
expect(user).to be_present
expect(RegistrationLog.first.user_id).to eq(user.id)
end
end

Expand Down
1 change: 0 additions & 1 deletion spec/support/features/session_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def fill_in_password_and_submit(password)

def sign_up
user = create(:user, :unconfirmed)
Funnel::Registration::Create.call(user.id)
confirm_last_user
user
end
Expand Down