Skip to content

Commit 597d19f

Browse files
committed
Make update types consistent
1 parent cf4cae8 commit 597d19f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Identity/Extensions.Core/src/UserManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -997,11 +997,11 @@ public virtual async Task<IdentityResult> UpdateSecurityStampAsync(TUser user)
997997
ArgumentNullThrowHelper.ThrowIfNull(user);
998998

999999
await UpdateSecurityStampInternal(user).ConfigureAwait(false);
1000-
return await UpdateUserAndRecordMetricAsync(user, UserUpdateType.SecurityStamp, startTimeStamp).ConfigureAwait(false);
1000+
return await UpdateUserAndRecordMetricAsync(user, UserUpdateType.UpdateSecurityStamp, startTimeStamp).ConfigureAwait(false);
10011001
}
10021002
catch (Exception ex)
10031003
{
1004-
_metrics?.UpdateUser(typeof(TUser).FullName!, result: null, UserUpdateType.SecurityStamp, startTimeStamp, ex);
1004+
_metrics?.UpdateUser(typeof(TUser).FullName!, result: null, UserUpdateType.UpdateSecurityStamp, startTimeStamp, ex);
10051005
throw;
10061006
}
10071007
}
@@ -2217,17 +2217,17 @@ public virtual async Task<IdentityResult> AccessFailedAsync(TUser user)
22172217
var count = await store.IncrementAccessFailedCountAsync(user, CancellationToken).ConfigureAwait(false);
22182218
if (count < Options.Lockout.MaxFailedAccessAttempts)
22192219
{
2220-
return await UpdateUserAndRecordMetricAsync(user, UserUpdateType.AccessFailed, startTimestamp).ConfigureAwait(false);
2220+
return await UpdateUserAndRecordMetricAsync(user, UserUpdateType.IncrementAccessFailed, startTimestamp).ConfigureAwait(false);
22212221
}
22222222
Logger.LogDebug(LoggerEventIds.UserLockedOut, "User is locked out.");
22232223
await store.SetLockoutEndDateAsync(user, DateTimeOffset.UtcNow.Add(Options.Lockout.DefaultLockoutTimeSpan),
22242224
CancellationToken).ConfigureAwait(false);
22252225
await store.ResetAccessFailedCountAsync(user, CancellationToken).ConfigureAwait(false);
2226-
return await UpdateUserAndRecordMetricAsync(user, UserUpdateType.AccessFailed, startTimestamp).ConfigureAwait(false);
2226+
return await UpdateUserAndRecordMetricAsync(user, UserUpdateType.IncrementAccessFailed, startTimestamp).ConfigureAwait(false);
22272227
}
22282228
catch (Exception ex)
22292229
{
2230-
_metrics?.UpdateUser(typeof(TUser).FullName!, result: null, UserUpdateType.AccessFailed, startTimestamp, ex);
2230+
_metrics?.UpdateUser(typeof(TUser).FullName!, result: null, UserUpdateType.IncrementAccessFailed, startTimestamp, ex);
22312231
throw;
22322232
}
22332233
}

src/Identity/Extensions.Core/src/UserManagerMetrics.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private static string GetUpdateType(UserUpdateType updateType)
255255
UserUpdateType.SetUserName => "set_user_name",
256256
UserUpdateType.AddPassword => "add_password",
257257
UserUpdateType.ChangePassword => "change_password",
258-
UserUpdateType.SecurityStamp => "security_stamp",
258+
UserUpdateType.UpdateSecurityStamp => "update_security_stamp",
259259
UserUpdateType.ResetPassword => "reset_password",
260260
UserUpdateType.RemoveLogin => "remove_login",
261261
UserUpdateType.AddLogin => "add_login",
@@ -274,7 +274,7 @@ private static string GetUpdateType(UserUpdateType updateType)
274274
UserUpdateType.SetTwoFactorEnabled => "set_two_factor_enabled",
275275
UserUpdateType.SetLockoutEnabled => "set_lockout_enabled",
276276
UserUpdateType.SetLockoutEndDate => "set_lockout_end_date",
277-
UserUpdateType.AccessFailed => "access_failed",
277+
UserUpdateType.IncrementAccessFailed => "increment_access_failed",
278278
UserUpdateType.ResetAccessFailedCount => "reset_access_failed_count",
279279
UserUpdateType.SetAuthenticationToken => "set_authentication_token",
280280
UserUpdateType.RemoveAuthenticationToken => "remove_authentication_token",

src/Identity/Extensions.Core/src/UserUpdateType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal enum UserUpdateType
99
SetUserName,
1010
AddPassword,
1111
ChangePassword,
12-
SecurityStamp,
12+
UpdateSecurityStamp,
1313
ResetPassword,
1414
RemoveLogin,
1515
AddLogin,
@@ -28,7 +28,7 @@ internal enum UserUpdateType
2828
SetTwoFactorEnabled,
2929
SetLockoutEnabled,
3030
SetLockoutEndDate,
31-
AccessFailed,
31+
IncrementAccessFailed,
3232
ResetAccessFailedCount,
3333
SetAuthenticationToken,
3434
RemoveAuthenticationToken,

0 commit comments

Comments
 (0)