@@ -33,7 +33,10 @@ def track_login_success(trace = nil, span = nil, user:, **others)
33
33
34
34
raise ArgumentError , 'missing required key: :user => { :id }' if user_id . nil?
35
35
36
- others [ 'usr.login' ] ||= user_options . fetch ( :login , user_id )
36
+ if !others . key? ( 'usr.login' ) && !others . key? ( :'usr.login' )
37
+ others [ 'usr.login' ] = user_options . fetch ( :login , user_id )
38
+ end
39
+
37
40
track ( LOGIN_SUCCESS_EVENT , active_trace , active_span , **others )
38
41
39
42
Kit ::Identity . set_user ( active_trace , active_span , id : user_id , **user_options )
@@ -56,7 +59,7 @@ def track_login_success(trace = nil, span = nil, user:, **others)
56
59
# event information to attach to the trace.
57
60
def track_login_failure ( trace = nil , span = nil , user_exists :, user_id : nil , **others )
58
61
set_trace_and_span_context ( 'track_login_failure' , trace , span ) do |active_trace , active_span |
59
- others [ 'usr.login' ] || = user_id if user_id
62
+ others [ 'usr.login' ] = user_id if user_id && ! others . key? ( 'usr.login' ) && ! others . key? ( :'usr.login' )
60
63
track ( LOGIN_FAILURE_EVENT , active_trace , active_span , **others )
61
64
62
65
active_span . set_tag ( 'appsec.events.users.login.failure.usr.id' , user_id ) if user_id
0 commit comments