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
2 changes: 1 addition & 1 deletion app/controllers/concerns/idv_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module IdvSession
extend ActiveSupport::Concern

def confirm_idv_session_started
return if current_user.decorate.needs_profile_usps_verification?
return if current_user.decorate.pending_profile_requires_verification?
redirect_to idv_session_url if idv_session.params.blank?
end

Expand Down
13 changes: 2 additions & 11 deletions app/controllers/concerns/verify_profile_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,8 @@ def account_or_verify_profile_url

def account_or_verify_profile_route
return 'account' if idv_context? || profile_context?
return 'account' unless current_user.decorate.pending_profile_requires_verification?
verify_profile_route
end

def verify_profile_route
decorated_user = current_user.decorate
if decorated_user.needs_profile_phone_verification?
flash[:notice] = t('account.index.verification.instructions')
return 'verify_profile_phone'
end
return 'verify_account' if decorated_user.needs_profile_usps_verification?
return 'account' unless profile_needs_verification?
'verify_account'
end

def profile_needs_verification?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/come_back_later_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def show; end
private

def confirm_user_needs_usps_confirmation
redirect_to account_url unless current_user.decorate.needs_profile_usps_verification?
redirect_to account_url unless current_user.decorate.pending_profile_requires_verification?
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/idv/usps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create
create_user_event(:usps_mail_sent, current_user)
idv_session.address_verification_mechanism = :usps

if current_user.decorate.needs_profile_usps_verification?
if current_user.decorate.pending_profile_requires_verification?
resend_letter
redirect_to idv_come_back_later_url
else
Expand Down
44 changes: 0 additions & 44 deletions app/controllers/users/verify_profile_phone_controller.rb

This file was deleted.

8 changes: 0 additions & 8 deletions app/decorators/user_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@ def active_profile_newer_than_pending_profile?
user.active_profile.activated_at >= pending_profile.created_at
end

def needs_profile_phone_verification?
pending_profile_requires_verification? && pending_profile.phone_confirmed?
end

def needs_profile_usps_verification?
pending_profile_requires_verification? && !pending_profile.phone_confirmed?
end

# This user's most recently activated profile that has also been deactivated
# due to a password reset, or nil if there is no such profile
def password_reset_profile
Expand Down
2 changes: 2 additions & 0 deletions app/models/profile.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Profile < ApplicationRecord
self.ignored_columns = %w[phone_confirmed]

belongs_to :user
has_many :usps_confirmation_codes, dependent: :destroy

Expand Down
4 changes: 1 addition & 3 deletions app/services/idv/profile_maker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ module Idv
class ProfileMaker
attr_reader :pii_attributes

def initialize(applicant:, user:, phone_confirmed:, user_password:)
def initialize(applicant:, user:, user_password:)
self.pii_attributes = Pii::Attributes.new_from_hash(applicant)
self.user = user
self.user_password = user_password
self.phone_confirmed = phone_confirmed
end

def save_profile
profile = Profile.new(
deactivation_reason: :verification_pending,
phone_confirmed: phone_confirmed,
user: user
)
profile.encrypt_pii(pii_attributes, user_password)
Expand Down
1 change: 0 additions & 1 deletion app/services/idv/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def applicant_params
def build_profile_maker(user_password)
Idv::ProfileMaker.new(
applicant: applicant_params,
phone_confirmed: vendor_phone_confirmation || false,
user: current_user,
user_password: user_password
)
Expand Down
4 changes: 1 addition & 3 deletions app/view_models/account_show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ def password_reset_partial
end

def pending_profile_partial
if decorated_user.needs_profile_usps_verification?
if decorated_user.pending_profile_requires_verification?
'accounts/pending_profile_usps'
elsif decorated_user.needs_profile_phone_verification?
'accounts/pending_profile_phone'
else
'shared/null'
end
Expand Down
3 changes: 0 additions & 3 deletions app/views/accounts/_pending_profile_phone.html.slim

This file was deleted.

1 change: 0 additions & 1 deletion config/locales/account/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ en:
instructions: Your account requires a secret code to be verified.
reactivate_button: Enter the code you received via US mail
success: Your account has been verified.
with_phone_button: Verify with your phone
items:
delete_your_account: Delete your account
personal_key: Personal key
Expand Down
1 change: 0 additions & 1 deletion config/locales/account/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ es:
instructions: Su cuenta requiere que un código secreto sea verificado.
reactivate_button: Ingrese el código que recibió por correo postal.
success: Su cuenta ha sido verificada.
with_phone_button: Verifique con su teléfono.
items:
delete_your_account: Eliminar su cuenta
personal_key: Clave personal
Expand Down
1 change: 0 additions & 1 deletion config/locales/account/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ fr:
instructions: Votre compte requiert la vérification d'un code secret.
reactivate_button: Entrez le code que vous avez reçu par la poste
success: Votre compte a été vérifié.
with_phone_button: Verifiez avec votre téléphone
items:
delete_your_account: Supprimer votre compte
personal_key: Clé personnelle
Expand Down
2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@
as: :verify_personal_key
post '/account/reactivate/verify_personal_key' => 'users/verify_personal_key#create',
as: :create_verify_personal_key
get '/account/verify_phone' => 'users/verify_profile_phone#index', as: :verify_profile_phone
post '/account/verify_phone' => 'users/verify_profile_phone#create'
get '/account_recovery_setup' => 'account_recovery_setup#index'

if FeatureManagement.piv_cac_enabled?
Expand Down
8 changes: 4 additions & 4 deletions spec/controllers/idv/come_back_later_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

describe Idv::ComeBackLaterController do
let(:user) { build_stubbed(:user, :signed_up) }
let(:needs_profile_usps_verification) { true }
let(:pending_profile_requires_verification) { true }

before do
user_decorator = instance_double(UserDecorator)
allow(user_decorator).to receive(:needs_profile_usps_verification?).
and_return(needs_profile_usps_verification)
allow(user_decorator).to receive(:pending_profile_requires_verification?).
and_return(pending_profile_requires_verification)
allow(user).to receive(:decorate).and_return(user_decorator)
allow(subject).to receive(:current_user).and_return(user)
end
Expand All @@ -21,7 +21,7 @@
end

context 'user does not need USPS address verification' do
let(:needs_profile_usps_verification) { false }
let(:pending_profile_requires_verification) { false }

it 'redirects to the account path' do
get :show
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/idv/confirmations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def stub_idv_session
profile_maker = Idv::ProfileMaker.new(
applicant: applicant,
user: user,
phone_confirmed: true,
user_password: password
)
profile = profile_maker.save_profile
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/idv/usps_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@

context 'resending a letter' do
let(:has_pending_profile) { true }
let(:pending_profile) { create(:profile, phone_confirmed: false) }
let(:pending_profile) { create(:profile) }

before do
stub_sign_in(user)
stub_decorated_user_with_pending_profile(user)
allow(user.decorate).to receive(:needs_profile_usps_verification?).and_return(true)
allow(user.decorate).to receive(:pending_profile_requires_verification?).and_return(true)
end

it 'calls the UspsConfirmationMaker to send another letter and redirects' do
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/users/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@
profile = create(
:profile,
deactivation_reason: :verification_pending,
phone_confirmed: false,
pii: { ssn: '6666', dob: '1920-01-01' }
)
user = profile.user
Expand Down
3 changes: 1 addition & 2 deletions spec/controllers/users/verify_account_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
profile: pending_profile,
otp_fingerprint: Pii::Fingerprinter.fingerprint(otp)
)
allow(decorated_user).to receive(:needs_profile_phone_verification?).and_return(false)
allow(decorated_user).to receive(:needs_profile_usps_verification?).
allow(decorated_user).to receive(:pending_profile_requires_verification?).
and_return(has_pending_profile)
end

Expand Down
56 changes: 0 additions & 56 deletions spec/controllers/users/verify_profile_phone_controller_spec.rb

This file was deleted.

78 changes: 0 additions & 78 deletions spec/decorators/user_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,84 +204,6 @@
end
end

describe '#needs_profile_phone_verification?' do
context 'pending profile does not require verification' do
it 'returns false' do
user = User.new
user_decorator = UserDecorator.new(user)
allow(user_decorator).to receive(:pending_profile_requires_verification?).
and_return(false)

expect(user_decorator.needs_profile_phone_verification?).to eq false
end
end

context 'pending profile requires verification and phone is confirmed' do
it 'returns true' do
user = User.new
user_decorator = UserDecorator.new(user)
allow(user_decorator).to receive(:pending_profile_requires_verification?).
and_return(true)
allow(user_decorator).to receive(:pending_profile).
and_return(Profile.new(phone_confirmed: true))

expect(user_decorator.needs_profile_phone_verification?).to eq true
end
end

context 'pending profile requires verification and phone is not confirmed' do
it 'returns false' do
user = User.new
user_decorator = UserDecorator.new(user)
allow(user_decorator).to receive(:pending_profile_requires_verification?).
and_return(true)
allow(user_decorator).to receive(:pending_profile).
and_return(Profile.new(phone_confirmed: false))

expect(user_decorator.needs_profile_phone_verification?).to eq false
end
end
end

describe '#needs_profile_usps_verification?' do
context 'pending profile does not require verification' do
it 'returns false' do
user = User.new
user_decorator = UserDecorator.new(user)
allow(user_decorator).to receive(:pending_profile_requires_verification?).
and_return(false)

expect(user_decorator.needs_profile_usps_verification?).to eq false
end
end

context 'pending profile requires verification and phone is not confirmed' do
it 'returns true' do
user = User.new
user_decorator = UserDecorator.new(user)
allow(user_decorator).to receive(:pending_profile_requires_verification?).
and_return(true)
allow(user_decorator).to receive(:pending_profile).
and_return(Profile.new(phone_confirmed: false))

expect(user_decorator.needs_profile_usps_verification?).to eq true
end
end

context 'pending profile requires verification and phone is confirmed' do
it 'returns false' do
user = User.new
user_decorator = UserDecorator.new(user)
allow(user_decorator).to receive(:pending_profile_requires_verification?).
and_return(true)
allow(user_decorator).to receive(:pending_profile).
and_return(Profile.new(phone_confirmed: true))

expect(user_decorator.needs_profile_usps_verification?).to eq false
end
end
end

describe '#should_acknowledge_personal_key?' do
context 'user has no personal key' do
context 'service provider with loa1' do
Expand Down
Loading