Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor verify namespaces/urls to idv #2149

Merged
merged 14 commits into from
May 10, 2018
6 changes: 3 additions & 3 deletions .reek
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ LongParameterList:
RepeatedConditional:
exclude:
- Users::ResetPasswordsController
- VerifyController
- Verify::Base
- IdvController
- Idv::Base
- Rack::Attack
TooManyConstants:
exclude:
Expand Down Expand Up @@ -101,7 +101,7 @@ TooManyMethods:
- OpenidConnect::AuthorizationController
- Idv::Session
- User
- Verify::SessionsController
- Idv::SessionsController
- ServiceProviderSessionDecorator
- SessionDecorator
UncommunicativeMethodName:
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/concerns/idv_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ module IdvSession

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

def confirm_idv_attempts_allowed
if idv_attempter.exceeded?
flash[:error] = t('idv.errors.hardfail')
analytics.track_event(Analytics::IDV_MAX_ATTEMPTS_EXCEEDED, request_path: request.path)
redirect_to verify_fail_url
redirect_to idv_fail_url
elsif idv_attempter.reset_attempts?
idv_attempter.reset
end
end

def confirm_idv_needed
redirect_to verify_activated_url if current_user.active_profile.present?
redirect_to idv_activated_url if current_user.active_profile.present?
end

def confirm_idv_vendor_session_started
return if flash[:allow_confirmations_continue]
redirect_to verify_session_url unless idv_session.proofing_started?
redirect_to idv_session_url unless idv_session.proofing_started?
end

def idv_session
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/idv_step_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def confirm_step_allowed

def redirect_to_fail_url
flash[:max_attempts_exceeded] = true
redirect_to verify_fail_url
redirect_to idv_fail_url
end
end
4 changes: 2 additions & 2 deletions app/controllers/concerns/two_factor_authenticatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def reset_otp_session_data

def after_otp_verification_confirmation_url
if idv_context?
verify_review_url
idv_review_url
elsif after_otp_action_required?
after_otp_action_url
else
Expand Down Expand Up @@ -289,7 +289,7 @@ def decorated_user
def reenter_phone_number_path
locale = LinkLocaleResolver.locale
if idv_context?
verify_phone_path(locale: locale)
idv_phone_path(locale: locale)
elsif current_user.phone.present?
manage_phone_path(locale: locale)
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Verify
module Idv
class AddressController < ApplicationController
include IdvStepConcern

Expand Down Expand Up @@ -27,14 +27,14 @@ def address_delivery_params
def address_delivery_destination
destination = address_delivery_params[:address_delivery_method]
if destination == 'phone'
verify_phone_path
idv_phone_path
elsif destination == 'usps'
verify_usps_path
idv_usps_path
end
end

def confirm_step_needed
redirect_to verify_review_url if idv_session.address_mechanism_chosen?
redirect_to idv_review_url if idv_session.address_mechanism_chosen?
end
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Verify
module Idv
class ComeBackLaterController < ApplicationController
include IdvSession

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Verify
module Idv
class ConfirmationsController < ApplicationController
include IdvSession

Expand All @@ -22,7 +22,7 @@ def next_step
if session[:sp] && !pending_profile?
sign_up_completed_url
elsif pending_profile? && idv_session.address_verification_mechanism == 'usps'
verify_come_back_later_url
idv_come_back_later_url
else
after_sign_in_path_for(current_user)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Verify
module Idv
class OtpDeliveryMethodController < ApplicationController
include IdvSession
include PhoneConfirmation
Expand Down Expand Up @@ -26,12 +26,12 @@ def create
private

def confirm_phone_step_complete
redirect_to verify_review_url if idv_session.vendor_phone_confirmation != true
redirect_to idv_review_url if idv_session.vendor_phone_confirmation != true
end

def confirm_step_needed
redirect_to verify_review_url if idv_session.address_verification_mechanism != 'phone' ||
idv_session.user_phone_confirmation == true
redirect_to idv_review_url if idv_session.address_verification_mechanism != 'phone' ||
idv_session.user_phone_confirmation == true
end

def otp_delivery_selection_params
Expand All @@ -41,7 +41,7 @@ def otp_delivery_selection_params
end

def set_otp_delivery_method_presenter
@set_otp_delivery_method_presenter = OtpDeliveryMethodPresenter.new(
@set_otp_delivery_method_presenter = Idv::OtpDeliveryMethodPresenter.new(
idv_session.params[:phone]
)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Verify
module Idv
class PhoneController < ApplicationController
include IdvStepConcern
include IdvFailureConcern
Expand All @@ -18,7 +18,7 @@ def create

if result.success?
Idv::Job.submit(idv_session, [:address])
redirect_to verify_phone_result_url
redirect_to idv_phone_result_url
else
@view_model = view_model
render :new
Expand All @@ -42,9 +42,9 @@ def show

def redirect_to_next_step
if phone_confirmation_required?
redirect_to verify_otp_delivery_method_url
redirect_to idv_otp_delivery_method_url
else
redirect_to verify_review_url
redirect_to idv_review_url
end
end

Expand All @@ -65,7 +65,7 @@ def step
end

def view_model_class
Verify::PhoneNew
Idv::PhoneNew
end

def step_params
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Verify
module Idv
class ReviewController < ApplicationController
include IdvStepConcern
include PhoneConfirmation
Expand All @@ -8,8 +8,8 @@ class ReviewController < ApplicationController
before_action :confirm_current_password, only: [:create]

def confirm_idv_steps_complete
return redirect_to(verify_session_url) unless idv_profile_complete?
return redirect_to(verify_address_url) unless idv_address_complete?
return redirect_to(idv_session_url) unless idv_profile_complete?
return redirect_to(idv_address_url) unless idv_address_complete?
end

def confirm_idv_phone_confirmed
Expand All @@ -26,7 +26,7 @@ def confirm_current_password
return if valid_password?

flash[:error] = t('idv.errors.incorrect_password')
redirect_to verify_review_url
redirect_to idv_review_url
end

def new
Expand All @@ -44,7 +44,7 @@ def new

def create
init_profile
redirect_to verify_confirmations_url
redirect_to idv_confirmations_url
analytics.track_event(Analytics::IDV_REVIEW_COMPLETE)

return unless FeatureManagement.reveal_usps_code?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Verify
module Idv
class SessionsController < ApplicationController
include IdvSession
include IdvFailureConcern
Expand All @@ -25,7 +25,7 @@ def create

if result.success?
Idv::Job.submit(idv_session, %i[resolution state_id])
redirect_to verify_session_result_url
redirect_to idv_session_result_url
else
process_failure
end
Expand All @@ -51,7 +51,7 @@ def destroy
private

def confirm_step_needed
redirect_to verify_address_url if idv_session.profile_confirmation == true
redirect_to idv_address_url if idv_session.profile_confirmation == true
end

def step
Expand All @@ -73,13 +73,13 @@ def process_success
:strong, t('idv.messages.sessions.pii')
)
flash[:success] = t('idv.messages.sessions.success', pii_message: pii_msg)
redirect_to verify_address_url
redirect_to idv_address_url
end

def process_failure
if idv_form.duplicate_ssn?
flash[:error] = t('idv.errors.duplicate_ssn')
redirect_to verify_session_dupe_url
redirect_to idv_session_dupe_url
else
render_failure
@view_model.unsupported_jurisdiction_error(decorated_session.sp_name)
Expand All @@ -88,7 +88,7 @@ def process_failure
end

def view_model_class
Verify::SessionsNew
Idv::SessionsNew
end

def remaining_step_attempts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Verify
module Idv
class UspsController < ApplicationController
include IdvStepConcern

Expand All @@ -14,9 +14,9 @@ def create

if current_user.decorate.needs_profile_usps_verification?
resend_letter
redirect_to verify_come_back_later_url
redirect_to idv_come_back_later_url
else
redirect_to verify_review_url
redirect_to idv_review_url
end
end

Expand All @@ -27,8 +27,8 @@ def usps_mail_service
private

def confirm_mail_not_spammed
redirect_to verify_review_url if idv_session.address_mechanism_chosen? &&
usps_mail_service.mail_spammed?
redirect_to idv_review_url if idv_session.address_mechanism_chosen? &&
usps_mail_service.mail_spammed?
end

def resend_letter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class VerifyController < ApplicationController
class IdvController < ApplicationController
include IdvSession
include AccountReactivationConcern

Expand All @@ -8,24 +8,24 @@ class VerifyController < ApplicationController

def index
if active_profile?
redirect_to verify_activated_url
redirect_to idv_activated_url
elsif idv_attempter.exceeded?
redirect_to verify_fail_url
redirect_to idv_fail_url
else
analytics.track_event(Analytics::IDV_INTRO_VISIT)
end
end

def activated
redirect_to verify_url unless active_profile?
redirect_to idv_url unless active_profile?
idv_attempter.reset
idv_session.clear
end

def cancel; end

def fail
redirect_to verify_url unless ok_to_fail?
redirect_to idv_url unless ok_to_fail?
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/openid_connect/authorization_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def handle_successful_handoff

def redirect_to_account_or_verify_profile_url
return redirect_to(account_or_verify_profile_url) if profile_needs_verification?
redirect_to(verify_url) if identity_needs_verification?
redirect_to(idv_url) if identity_needs_verification?
end

def profile_or_identity_needs_verification?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/reactivate_account_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ def index; end

def update
reactivate_account_session.suspend
redirect_to verify_url
redirect_to idv_url
end
end
2 changes: 1 addition & 1 deletion app/controllers/saml_idp_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def cert_rotation_saml_metadata

def redirect_to_account_or_verify_profile_url
return redirect_to(account_or_verify_profile_url) if profile_needs_verification?
redirect_to(verify_url) if identity_needs_verification?
redirect_to(idv_url) if identity_needs_verification?
end

def profile_or_identity_needs_verification?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sign_up/completions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def view_model
end

def verify_confirmed
redirect_to verify_url if current_user.decorate.identity_not_verified?
redirect_to idv_url if current_user.decorate.identity_not_verified?
end

def loa3?
Expand Down
2 changes: 1 addition & 1 deletion app/decorators/service_provider_session_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def verification_method_choice
end

def idv_hardfail4_partial
'verify/hardfail4'
'idv/hardfail4'
end

def requested_attributes
Expand Down
2 changes: 1 addition & 1 deletion app/decorators/session_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def verification_method_choice
end

def idv_hardfail4_partial
'verify/no_sp_hardfail'
'idv/no_sp_hardfail'
end

def cancel_link_url
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def sign_up_or_idv_no_js_link
if user_signing_up?
destroy_user_path
elsif user_verifying_identity?
verify_session_path
idv_session_path
end
end

Expand Down
Loading