Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
c94595c
Add setup router
mdiarra3 Mar 28, 2022
5a69fd4
delete authenticator service
mdiarra3 Mar 28, 2022
772a3e8
LG-5988: work on routing for multiple selections
mdiarra3 Mar 30, 2022
9f271df
LG-5988: remove uneeded helper
mdiarra3 Mar 30, 2022
de283b3
changelog: New Feature, Allow Users to add more than one MFA method o…
mdiarra3 Apr 1, 2022
6f59e6c
LG-5988: spec
mdiarra3 Apr 1, 2022
28abaac
Merge remote-tracking branch 'origin/main' into LG-5988-routing
mdiarra3 Apr 4, 2022
0242e4e
LG-5988: address comments
mdiarra3 Apr 4, 2022
ef86228
rubocop
mdiarra3 Apr 4, 2022
f675d1d
Refactor how were doing user updating otp method
mdiarra3 Apr 4, 2022
b0a7688
rubocop
mdiarra3 Apr 4, 2022
fd1ed22
LG-5988: change method name
mdiarra3 Apr 5, 2022
d5f4f69
Merge remote-tracking branch 'origin/main' into LG-5988-routing
mdiarra3 Apr 5, 2022
45ce80e
redirect fix
mdiarra3 Apr 5, 2022
01bbcca
Merge remote-tracking branch 'origin/main' into LG-5988-routing
mdiarra3 Apr 5, 2022
0ee04bb
update routing
mdiarra3 Apr 6, 2022
5cf53cf
LG-5988: use index
mdiarra3 Apr 6, 2022
6eb5dab
Merge remote-tracking branch 'origin/LG-5988-routing' into LG-6086-ro…
mdiarra3 Apr 6, 2022
e382b88
use dig to reduce errors
mdiarra3 Apr 6, 2022
5b3f3e7
rubocop
mdiarra3 Apr 7, 2022
587ec95
LG-6086: routes
mdiarra3 Apr 7, 2022
7c9ef3a
check phone
mdiarra3 Apr 7, 2022
43bbc86
Ensure next url
mdiarra3 Apr 7, 2022
56df861
LG-6086: check to see if next available
mdiarra3 Apr 7, 2022
0445fdd
LG-5988: rubocop
mdiarra3 Apr 7, 2022
fe76987
LG-6086: add translations for language
mdiarra3 Apr 8, 2022
a61fbd1
Merge remote-tracking branch 'origin/main' into LG-5988-routing
mdiarra3 Apr 8, 2022
662840a
LG-5988: use shift for now
mdiarra3 Apr 8, 2022
08f314a
Merge remote-tracking branch 'origin/LG-5988-routing' into LG-6086-ro…
mdiarra3 Apr 11, 2022
a878211
LG-6086: route to interstatial
mdiarra3 Apr 13, 2022
ae34d68
Merge remote-tracking branch 'origin/main' into LG-6086-route-to-inte…
mdiarra3 Apr 13, 2022
13f85fd
LG-6086: rubocop
mdiarra3 Apr 13, 2022
a921746
move params call to own method
mdiarra3 Apr 14, 2022
1c9cb61
LG-6086: have show visible
mdiarra3 Apr 14, 2022
6efa972
totp fix
mdiarra3 Apr 14, 2022
9aec253
Normalize yaml
mdiarra3 Apr 14, 2022
3dd7438
LG-6086: routes
mdiarra3 Apr 14, 2022
af36a82
changelog: add interstitial page between page
mdiarra3 Apr 14, 2022
d2be2c9
LG-6086: use account url
mdiarra3 Apr 14, 2022
3ddac2e
rubocop issue
mdiarra3 Apr 14, 2022
218c9fc
multipel mfa signup fix
mdiarra3 Apr 15, 2022
91d9adb
multiple mfa signup featuere test fix
mdiarra3 Apr 15, 2022
d1cdf58
ensure you add a final path
mdiarra3 Apr 15, 2022
1b4ab36
Use url
mdiarra3 Apr 15, 2022
2d35d4a
LG-6086: refactor to support going back
mdiarra3 Apr 18, 2022
9da4bab
LG-6086: interstitial fixup tests
mdiarra3 Apr 18, 2022
bd3b4d3
check backup choice
mdiarra3 Apr 18, 2022
6efe29b
fix render issue
mdiarra3 Apr 18, 2022
f0a12c3
make sure to add params
mdiarra3 Apr 18, 2022
02a6c7b
rubocop
mdiarra3 Apr 18, 2022
42d2578
make sure to click properly
mdiarra3 Apr 18, 2022
35a7dfc
feature test fix
mdiarra3 Apr 18, 2022
a526856
LG-6086 clear session properly
mdiarra3 Apr 18, 2022
e7bcf73
update show
mdiarra3 Apr 18, 2022
0a503d3
fix html
mdiarra3 Apr 18, 2022
1a2d6cf
otp verification
mdiarra3 Apr 18, 2022
6d4d0fd
mfa confirmations controller logic fix
mdiarra3 Apr 19, 2022
1bd0a7b
LG-6086: remove ordanilize
mdiarra3 Apr 19, 2022
cb74851
update show presenter
mdiarra3 Apr 19, 2022
6672923
LG-6086: update presenter
mdiarra3 Apr 19, 2022
72b882f
LG-6086: fix missing keys
mdiarra3 Apr 19, 2022
47496fd
normalize yaml
mdiarra3 Apr 19, 2022
57dc127
next setup choice
mdiarra3 Apr 20, 2022
95842b3
changelog: Improvements, Authentication, Feature flagged full multipl…
mdiarra3 Apr 20, 2022
51c4a81
merge CTA
mdiarra3 Apr 25, 2022
13e0f50
LG-6086: update to fix tests
mdiarra3 Apr 28, 2022
7915d4d
fix locales
mdiarra3 Apr 28, 2022
2cab8b0
Merge remote-tracking branch 'origin/main' into LG-6086-route-to-inte…
mdiarra3 Apr 29, 2022
2584ab2
rename name
mdiarra3 Apr 29, 2022
b9911b1
spec
mdiarra3 Apr 29, 2022
7a2a1cc
mfa cta spec
mdiarra3 Apr 29, 2022
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
24 changes: 20 additions & 4 deletions app/controllers/concerns/mfa_setup_concern.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
module MfaSetupConcern
extend ActiveSupport::Concern

def user_next_authentication_setup_path!(final_path = nil)
case user_session[:selected_mfa_options]&.shift
def user_next_authentication_setup_path(next_setup_choice)
if user_session.dig(:selected_mfa_options, determine_next_mfa_selection).present? &&
IdentityConfig.store.select_multiple_mfa_options
auth_method_confirmation_url(next_setup_choice: next_setup_choice)
else
user_session.delete(:selected_mfa_options)
nil
end
end

def determine_next_mfa_selection
return unless user_session[:selected_mfa_options]
current_session = user_session[:next_mfa_selection_choice]
current_index = user_session[:selected_mfa_options].find_index(current_session) || 0
current_index + 1
end

def confirmation_path(next_mfa_selection_choice)
user_session[:next_mfa_selection_choice] = next_mfa_selection_choice
case next_mfa_selection_choice
when 'voice', 'sms', 'phone'
phone_setup_url
when 'auth_app'
Expand All @@ -15,8 +33,6 @@ def user_next_authentication_setup_path!(final_path = nil)
webauthn_setup_url(platform: true)
when 'backup_code'
backup_code_setup_url
else
final_path
end
end

Expand Down
26 changes: 25 additions & 1 deletion app/controllers/mfa_confirmation_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
class MfaConfirmationController < ApplicationController
before_action :confirm_two_factor_authenticated
include MfaSetupConcern
before_action :confirm_two_factor_authenticated, except: [:show]

def show
@presenter = MfaConfirmationShowPresenter.new(
current_user: current_user,
next_path: next_path,
final_path: after_mfa_setup_path,
)
end

def skip
user_session.delete(:selected_mfa_options)
user_session.delete(:next_mfa_selection_choice)
redirect_to after_mfa_setup_path
end

def new
session[:password_attempts] ||= 0
Expand All @@ -19,6 +34,15 @@ def password
params.require(:user)[:password]
end

def next_mfa_selection_choice
params[:next_setup_choice] ||
user_session[:next_mfa_selection_choice]
end

def next_path
confirmation_path(next_mfa_selection_choice)
end

def handle_valid_password
if current_user.auth_app_configurations.any?
redirect_to login_two_factor_authenticator_url(reauthn: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ def create
if result.success?
next_url = nil
if UserSessionContext.confirmation_context?(context)
next_url = user_next_authentication_setup_path!
next_mfa_setup_for_user = user_session.dig(
:selected_mfa_options,
determine_next_mfa_selection,
)
next_url = user_next_authentication_setup_path(
next_mfa_setup_for_user,
)
end
handle_valid_otp(next_url)
else
Expand Down
7 changes: 6 additions & 1 deletion app/controllers/users/backup_code_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ def edit; end

def continue
flash[:success] = t('notices.backup_codes_configured')
redirect_to user_next_authentication_setup_path!(after_mfa_setup_path)
next_mfa_setup_for_user = user_session.dig(
:selected_mfa_options,
determine_next_mfa_selection,
)
redirect_to user_next_authentication_setup_path(next_mfa_setup_for_user) ||
after_mfa_setup_path
end

def download
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ def process_valid_submission
Funnel::Registration::AddMfa.call(current_user.id, 'piv_cac')
session[:needs_to_setup_piv_cac_after_sign_in] = false
final_path = after_sign_in_path_for(current_user)
redirect_to user_next_authentication_setup_path!(final_path)
next_mfa_setup_for_user = user_session.dig(
:selected_mfa_options,
determine_next_mfa_selection,
)
redirect_to user_next_authentication_setup_path(next_mfa_setup_for_user) ||
final_path
end

def piv_cac_enabled?
Expand Down
7 changes: 6 additions & 1 deletion app/controllers/users/totp_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ def process_valid_code
handle_remember_device
flash[:success] = t('notices.totp_configured')
user_session.delete(:new_totp_secret)
redirect_to user_next_authentication_setup_path!(after_mfa_setup_path)
next_mfa_setup_for_user = user_session.dig(
:selected_mfa_options,
determine_next_mfa_selection,
)
redirect_to user_next_authentication_setup_path(next_mfa_setup_for_user) ||
after_mfa_setup_path
end

def handle_remember_device
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def two_factor_options_presenter

def process_valid_form
user_session[:selected_mfa_options] = @two_factor_options_form.selection
redirect_to user_next_authentication_setup_path!(user_session[:selected_mfa_options].first)
redirect_to confirmation_path(user_session[:selected_mfa_options].first)
end

def handle_empty_selection
Expand Down
7 changes: 6 additions & 1 deletion app/controllers/users/webauthn_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ def process_valid_webauthn(form)
end
user_session[:auth_method] = 'webauthn'

redirect_to user_next_authentication_setup_path!(after_mfa_setup_path)
next_mfa_setup_for_user = user_session.dig(
:selected_mfa_options,
determine_next_mfa_selection,
)
redirect_to user_next_authentication_setup_path(next_mfa_setup_for_user) ||
after_mfa_setup_path
end

def handle_remember_device
Expand Down
34 changes: 34 additions & 0 deletions app/presenters/mfa_confirmation_show_presenter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
class MfaConfirmationShowPresenter
include ActionView::Helpers::TranslationHelper
attr_reader :mfa_context, :final_path, :next_path
def initialize(current_user:, next_path:, final_path:)
@mfa_context = MfaContext.new(current_user)
@final_path = final_path
@next_path = next_path
end

def title
if enabled_method_count > 1
t(
'titles.mfa_setup.multiple_authentication_methods_setup',
method_count: method_count_text,
)
else
t('titles.mfa_setup.first_authentication_method')
end
end

def info
t('mfa.account_info', count: enabled_method_count)
end

private

def enabled_method_count
mfa_context.enabled_mfa_methods_count
end

def method_count_text
t('mfa.current_method_count')[enabled_method_count - 1]
end
end
21 changes: 0 additions & 21 deletions app/views/mfa_confirmation/index.html.erb

This file was deleted.

22 changes: 22 additions & 0 deletions app/views/mfa_confirmation/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<% title @presenter.title %>

<%= image_tag asset_url('user-signup-ial1.svg'), width: 107, height: 119, alt: '', class: 'margin-bottom-4' %>

<%= render PageHeadingComponent.new.with_content(@presenter.title) %>

<p class='margin-top-1 margin-bottom-4'><%= @presenter.info %></p>

<div class="col-12">
<%= link_to(
@presenter.next_path,
class: 'usa-button usa-button--wide usa-button--big margin-bottom-3',
) { t('mfa.add') } %>
</div>

<%= button_to(
auth_method_confirmation_skip_path,
method: :post,
class: 'usa-button usa-button--unstyled',
) do %>
<%= t('mfa.skip') %>
<% end %>
2 changes: 0 additions & 2 deletions config/locales/headings/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ en:
edit_info:
password: Change your password
phone: Manage your phone settings
mfa_setup:
first_authentication_method: You’ve added your first authentication method!
passwords:
change: Change your password
confirm: Confirm your current password to continue
Expand Down
2 changes: 0 additions & 2 deletions config/locales/headings/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ es:
edit_info:
password: Cambie su contraseña
phone: Administrar la configuración de su teléfono
mfa_setup:
first_authentication_method: ¡Has agregado tu primer método de autenticación!
passwords:
change: Cambie su contraseña
confirm: Confirme la contraseña actual para continuar
Expand Down
2 changes: 0 additions & 2 deletions config/locales/headings/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ fr:
edit_info:
password: Changez votre mot de passe
phone: Administrer les paramètres de votre téléphone
mfa_setup:
first_authentication_method: Vous avez ajouté votre première méthode d’authentification!
passwords:
change: Changez votre mot de passe
confirm: Confirmez votre mot de passe actuel pour continuer
Expand Down
18 changes: 14 additions & 4 deletions config/locales/mfa/en.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
---
en:
mfa:
account_info:
one: Adding another authentication method prevents you from getting locked out
of your account if you lose one of your methods.
other: Congratulations! You are doing very well to keep your account secure. Add
new devices to stay up to date.
add: Add another method
cta: Adding another authentication method prevents you from getting locked out
of your account if you lose one of your methods.
current_method_count:
- first
- second
- third
- fourth
- fifth
- sixth
- seventh
- eighth
info: We recommend you select at least (2) two different methods so you have a
backup if you lose one of your chosen authentication devices.
method_confirmation:
face_id: Face ID has been added to your account
second_method_warning:
link: Add a second authentication method.
text: You will have to delete your account and start over if you lose your only
Expand Down
18 changes: 14 additions & 4 deletions config/locales/mfa/es.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
---
es:
mfa:
account_info:
one: Agregar otro método de autenticación evita que se le bloquee el acceso a su
cuenta si pierde uno de sus métodos.
other: ¡Felicitaciones! Está haciendo muy bien en mantener su cuenta segura.
Añada nuevos dispositivos para mantenerse al día.
add: Agregar otro método
cta: Agregar otro método de autenticación evita que se le bloquee el acceso a su
cuenta si pierde uno de sus métodos.
current_method_count:
- primero
- segundo
- tercero
- cuarto
- quinto
- sexto
- séptimo
- octavo
info: Le recomendamos que seleccione al menos (2) dos métodos diferentes para
tener una copia de seguridad si pierde uno de los dispositivos de
autenticación elegidos.
method_confirmation:
face_id: Se ha agregado Face ID a su cuenta
second_method_warning:
link: Agregue un segundo método de autenticación.
text: Deberá eliminar su cuenta y comenzar de nuevo si pierde su único método de
Expand Down
18 changes: 14 additions & 4 deletions config/locales/mfa/fr.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
---
fr:
mfa:
account_info:
one: L’ajout d’une autre méthode d’authentification vous empêche d’être bloqué
sur votre compte si vous perdez l’une de vos méthodes.
other: Félicitations! Vous faites très bien d’assurer la sécurité de votre
compte. Ajoutez de nouveaux appareils pour rester à jour.
add: Agregar otro método
cta: L’ajout d’une autre méthode d’authentification vous empêche d’être bloqué
sur votre compte si vous perdez l’une de vos méthodes.
current_method_count:
- premiere
- deuxième
- troisième
- quatrième
- cinquième
- sixième
- septième
- huitième
info: Nous vous recommandons de sélectionner au moins (2) deux méthodes
différentes afin d’avoir une sauvegarde si vous perdez l’un de vos
dispositifs d’authentification choisis.
method_confirmation:
face_id: Face ID a été ajouté à votre compte
second_method_warning:
link: Ajoutez une deuxième méthode d’authentification.
text: Vous devrez supprimer votre compte et recommencer si vous perdez votre
Expand Down
1 change: 1 addition & 0 deletions config/locales/titles/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ en:
review: Re-enter your password
mfa_setup:
first_authentication_method: You’ve added your first authentication method!
multiple_authentication_methods_setup: You’ve added a %{method_count} authentication method!
no_auth_option: No sign-in method found
openid_connect:
authorization: OpenID Connect Authorization
Expand Down
1 change: 1 addition & 0 deletions config/locales/titles/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ es:
review: Vuelve a ingresar tu contraseña
mfa_setup:
first_authentication_method: ¡Has agregado tu primer método de autenticación!
multiple_authentication_methods_setup: ¡Se ha agregado un %{method_count} código de autenticación!
no_auth_option: No se encontró mensaje de inicio de sesión
openid_connect:
authorization: Autorización de OpenID Connect
Expand Down
1 change: 1 addition & 0 deletions config/locales/titles/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fr:
review: Saisissez à nouveau votre mot de passe
mfa_setup:
first_authentication_method: Vous avez ajouté votre première méthode d’authentification!
multiple_authentication_methods_setup: Vous avez ajouté une %{method_count} méthode d’authentification!
no_auth_option: Aucun message de connexion trouvé
openid_connect:
authorization: Autorisation OpenID Connect
Expand Down
5 changes: 2 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@
end
end

if IdentityConfig.store.select_multiple_mfa_options
get '/auth_method_confirmation' => 'mfa_confirmation#show'
end
get '/auth_method_confirmation' => 'mfa_confirmation#show'
post '/auth_method_confirmation/skip' => 'mfa_confirmation#skip'

# Non-devise-controller routes. Alphabetically sorted.
get '/.well-known/openid-configuration' => 'openid_connect/configuration#index',
Expand Down
Loading