-
Notifications
You must be signed in to change notification settings - Fork 166
Use the verify profile concern to sort through all of the reasons a user may be pending #8468
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| module VerifyProfileConcern | ||
| private | ||
|
|
||
| def account_or_verify_profile_url | ||
| return reactivate_account_url if user_needs_to_reactivate_account? | ||
| return idv_gpo_verify_url if profile_needs_verification? | ||
| account_url | ||
| def url_for_pending_profile_reason | ||
| return idv_gpo_verify_url if current_user.gpo_verification_pending_profile? | ||
| return idv_in_person_ready_to_verify_url if current_user.in_person_pending_profile? | ||
| return idv_please_call_url if current_user.fraud_review_pending? | ||
| idv_not_verified_url if current_user.fraud_rejection? | ||
| end | ||
|
|
||
| def profile_needs_verification? | ||
| def user_has_pending_profile? | ||
| return false if current_user.blank? | ||
| current_user.gpo_verification_pending_profile? || | ||
| user_needs_to_reactivate_account? | ||
| current_user.pending_profile? | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ class AuthorizationController < ApplicationController | |
| include SecureHeadersConcern | ||
| include AuthorizationCountConcern | ||
| include BillableEventTrackable | ||
| include FraudReviewConcern | ||
|
|
||
| before_action :build_authorize_form_from_params, only: [:index] | ||
| before_action :pre_validate_authorize_form, only: [:index] | ||
|
|
@@ -22,10 +21,12 @@ class AuthorizationController < ApplicationController | |
| before_action :prompt_for_password_if_ial2_request_and_pii_locked, only: [:index] | ||
|
|
||
| def index | ||
| return redirect_to_fraud_review if fraud_review_pending_for_ial2_request? | ||
| return redirect_to_fraud_rejection if fraud_rejection_for_ial2_request? | ||
| return redirect_to_account_or_verify_profile_url if profile_or_identity_needs_verification? | ||
| return redirect_to(sign_up_completed_url) if needs_completion_screen_reason | ||
| if @authorize_form.ial2_or_greater? | ||
|
||
| return redirect_to reactivate_account_url if user_needs_to_reactivate_account? | ||
| return redirect_to url_for_pending_profile_reason if user_has_pending_profile? | ||
| return redirect_to idv_url if identity_needs_verification? | ||
| end | ||
| return redirect_to sign_up_completed_url if needs_completion_screen_reason | ||
| link_identity_to_service_provider | ||
|
|
||
| result = @authorize_form.submit | ||
|
|
@@ -76,26 +77,6 @@ def handle_successful_handoff | |
| delete_branded_experience | ||
| end | ||
|
|
||
| def redirect_to_account_or_verify_profile_url | ||
| return redirect_to(account_or_verify_profile_url) if profile_needs_verification? | ||
| redirect_to(idv_url) if identity_needs_verification? | ||
| end | ||
|
|
||
| def fraud_review_pending_for_ial2_request? | ||
| return false unless @authorize_form.ial2_or_greater? | ||
| fraud_review_pending? | ||
| end | ||
|
|
||
| def fraud_rejection_for_ial2_request? | ||
| return false unless @authorize_form.ial2_or_greater? | ||
| fraud_rejection? | ||
| end | ||
|
|
||
| def profile_or_identity_needs_verification? | ||
| return false unless @authorize_form.ial2_or_greater? | ||
| profile_needs_verification? || identity_needs_verification? | ||
| end | ||
|
|
||
| def track_authorize_analytics(result) | ||
| analytics_attributes = result.to_h.except(:redirect_uri). | ||
| merge(user_fully_authenticated: user_fully_authenticated?) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth trying to move away from the generic "has pending profile"? If we wanted to, we could take a small shortcut and replace the conditionals used with:
It looks like the method would still be used by some analytics, but it might be worth splitting that up to be more specific too.