Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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/users/piv_cac_login_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def error
private

def render_prompt
analytics.piv_cac_setup_visit(in_account_creation_flow: false)
analytics.piv_cac_login_visited
@presenter = PivCacAuthenticationLoginPresenter.new(piv_cac_login_form, url_options)
render :new
end
Expand Down
10 changes: 8 additions & 2 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2660,13 +2660,14 @@ def multi_factor_auth_added_phone(enabled_mfa_methods_count:, **extra)
)
end

# @identity.idp.previous_event_name Multi-Factor Authentication: Added PIV_CAC
# Tracks when the user has added the MFA method piv_cac to their account
# @param [Integer] enabled_mfa_methods_count number of registered mfa methods for the user
# @param [Boolean] in_account_creation_flow whether user is going through creation flow
def multi_factor_auth_added_piv_cac(enabled_mfa_methods_count:, in_account_creation_flow:,
**extra)
track_event(
'Multi-Factor Authentication: Added PIV_CAC',
'Multi-Factor Authentication: Added PIV CAC',
Comment thread
mdiarra3 marked this conversation as resolved.
Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate to reopen pandora's box, but depending on the outcome of #9318, we may be establishing a new naming convention. Would you want to consider jumping to that new convention or holding off on a rename?

I guess my concern is whether it's worth "fixing" the name if the naming convention is going to change anyways.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ill hold off on renaming tbh, since its gonna change anyways.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#9318 is merged now if you want to go ahead and rebase / adjust.

{
method_name: :piv_cac,
enabled_mfa_methods_count:,
Expand Down Expand Up @@ -3403,18 +3404,23 @@ def piv_cac_disabled
track_event('PIV CAC disabled')
end

# @identity.idp.previous_event_name PIV/CAC login
# @param [Boolean] success
# @param [Hash] errors
# tracks piv cac login event
def piv_cac_login(success:, errors:, **extra)
track_event(
'PIV/CAC Login',
'PIV CAC login',
Comment thread
mdiarra3 marked this conversation as resolved.
Outdated
success: success,
errors: errors,
**extra,
)
end

def piv_cac_login_visited
track_event('PIV CAC login visited')
end

# @identity.idp.previous_event_name User Registration: piv cac setup visited
# Tracks when user's piv cac setup
# @param [Boolean] in_account_creation_flow
Expand Down
11 changes: 5 additions & 6 deletions spec/controllers/users/piv_cac_login_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
context 'without a token' do
before { get :new }

it 'tracks the piv_cac setup' do
it 'tracks the piv cac login' do
expect(@analytics).to have_received(:track_event).with(
'PIV CAC setup visited',
in_account_creation_flow: false,
'PIV CAC login visited',
)
end

Expand All @@ -29,7 +28,7 @@
before { get :new, params: { token: token } }
it 'tracks the login attempt' do
expect(@analytics).to have_received(:track_event).with(
'PIV/CAC Login',
'PIV CAC login',
{
errors: {},
key_id: nil,
Expand Down Expand Up @@ -74,7 +73,7 @@

it 'tracks the login attempt' do
expect(@analytics).to have_received(:track_event).with(
'PIV/CAC Login',
'PIV CAC login',
{
errors: {
type: 'user.not_found',
Expand Down Expand Up @@ -113,7 +112,7 @@

it 'tracks the login attempt' do
expect(@analytics).to have_received(:track_event).with(
'PIV/CAC Login',
'PIV CAC login',
{
errors: {},
key_id: nil,
Expand Down