-
Notifications
You must be signed in to change notification settings - Fork 167
LG-12609 piv interstitial method #10282
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 6 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
cf15c61
interstitial
mdiarra3 b0b470a
add routes and migration
mdiarra3 49f9501
changelog: User-Facing Improvements, PIV/CAC, Add Piv interstitial pa…
mdiarra3 f3b53d7
possible piv user
mdiarra3 d0e660e
Merge remote-tracking branch 'origin' into LG-12609-piv-interstitial-…
mdiarra3 fc237df
possible piv user
mdiarra3 bdc91f4
possible piv user built
mdiarra3 f430663
rename controller to something more cohesive, add spec for controller
mdiarra3 3a9865d
rubocop fixes
mdiarra3 1af7c19
concern for pivcac
mdiarra3 47cd734
MFA setup redirect to piv for proper emails
mdiarra3 222921e
piv cac
mdiarra3 e94c8f5
Merge remote-tracking branch 'origin/main' into LG-12609-piv-intersti…
mdiarra3 8fe6af8
Add piv cac recommended presenter and data
mdiarra3 2c4bf1e
update translations
mdiarra3 c681547
add spec and stub piv cac
mdiarra3 1532046
piv cac recommended show
mdiarra3 0788dbf
refactor mfa selection concern
mdiarra3 4512e24
User-Facing Improvements, Piv/Cac, add Migration to add piv visited a…
mdiarra3 962a3b9
update schema
mdiarra3 13146a6
put back pgcrypto
mdiarra3 1fa72f9
rubocop and analytic events
mdiarra3 d234f0b
changelog: User-Facing Improvements, PIV/CAC, Piv Migration for added…
mdiarra3 9dd3665
update schema and change to dismissed at
mdiarra3 762d863
remove unneeded migration
mdiarra3 723e9ed
fix schema
mdiarra3 6bbce2c
Merge remote-tracking branch 'origin/LG-12609-piv-migration' into LG-…
mdiarra3 d1690ea
address comments, piv cac recommended controller fix and reorder anal…
mdiarra3 a985060
change method name to be clearer
mdiarra3 023ac7b
change back to confirmation check
mdiarra3 48276b1
rubocop fix
mdiarra3 2613260
rubocop and mfa concern
mdiarra3 68fe595
Merge remote-tracking branch 'origin/main' into LG-12609-piv-intersti…
mdiarra3 8d05c25
address comments, delete obsolete migration
mdiarra3 a137b30
make sure to check controller for proper redirecting
mdiarra3 42456ba
make unstyled
mdiarra3 2325057
rubocop and fix method
mdiarra3 11bc57e
Merge remote-tracking branch 'origin/main' into LG-12609-piv-intersti…
mdiarra3 dd40dc0
commit option
mdiarra3 7da27a5
remove unneeded schema change
mdiarra3 55ab8ac
address comments
mdiarra3 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,4 +44,4 @@ def piv_cac_setup_csp_form_action_uris | |
| end | ||
| [piv_cac_uri] + csp_uris | ||
| end | ||
| 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 |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| module Users | ||
| class PossiblePivUserController < ApplicationController | ||
| include TwoFactorAuthenticatableMethods | ||
| include MfaSetupConcern | ||
| include SecureHeadersConcern | ||
| include ReauthenticationRequiredConcern | ||
|
|
||
| before_action :authenticate_user! | ||
| before_action :confirm_user_authenticated_for_2fa_setup | ||
| before_action :apply_secure_headers_override | ||
| before_action :user_email_is_gov_or_mil? | ||
|
|
||
| helper_method :in_multi_mfa_selection_flow? | ||
|
|
||
| def show | ||
| @email_type = email_type | ||
| analytics.gov_or_mil_email_detected_visited | ||
| end | ||
|
|
||
| def confirm | ||
| UpdateUser.new(user: current_user, attributes: { piv_cac_recommended_dismissed: true }).call | ||
| user_session[:mfa_selections] = ['piv_cac'] | ||
| redirect_to confirmation_path(user_session[:mfa_selections].first) | ||
| end | ||
|
|
||
|
|
||
| private | ||
|
|
||
| def user_email_is_gov_or_mil? | ||
| redirect_to after_sign_in_path_for(current_user) unless current_user.has_gov_or_mil_email? | ||
| end | ||
|
|
||
| def email_type | ||
| address = current_user.confirmed_email_addresses.select {|address| address.gov_or_mil? } | ||
| case address.first.email.end_with?('.gov') | ||
| when true | ||
| '.gov' | ||
| else | ||
| '.mil' | ||
| end | ||
| end | ||
| 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
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
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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <% self.title = t('titles.piv_cac_setup.upsell') %> | ||
|
|
||
| <%= render AlertIconComponent.new(icon_name: :info_question) %> | ||
|
|
||
| <%= render PageHeadingComponent.new.with_content(t('titles.piv_cac_setup.upsell')) %> | ||
|
|
||
| <p> | ||
| <%= t('two_factor_authentication.piv_cac_upsell.info', email_type: @email_type) %> | ||
| </p> | ||
|
|
||
| <%= render ButtonComponent.new( | ||
| action: ->(**tag_options, &block) do | ||
| button_to( | ||
| login_add_piv_for_user_path, | ||
| **tag_options, | ||
| &block | ||
| ) | ||
| end, | ||
| big: true, | ||
| class: 'margin-bottom-2', | ||
| ).with_content(t('two_factor_authentication.piv_cac_upsell.add_piv')) %> | ||
|
|
||
| <% if MfaPolicy.new(current_user).two_factor_enabled? %> | ||
| <%= link_to t('links.cancel'), account_path %> | ||
| <% else %> | ||
| <%= link_to t('two_factor_authentication.piv_cac_upsell.choose_other_method'), authentication_methods_setup_path %> | ||
| <% 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
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
5 changes: 5 additions & 0 deletions
5
db/primary_migrate/20240321121322_add_pivcac_notice_on_user.rb
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class AddPivcacNoticeOnUser < ActiveRecord::Migration[7.1] | ||
| def change | ||
| add_column :users, :piv_cac_recommended_dismissed, :boolean, default: false | ||
| end | ||
| end |
|
mdiarra3 marked this conversation as resolved.
|
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.
Uh oh!
There was an error while loading. Please reload this page.