Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Fix user last activity bump based on order of commands (#2143)
Leendert de Borstcecd124a9fd5
diff --git a/apps/server/AliasVault.Api/Controllers/V1/AuthController.cs b/apps/server/AliasVault.Api/Controllers/V1/AuthController.csindex 91d24a136..4d237b9ef 100644--- a/apps/server/AliasVault.Api/Controllers/V1/AuthController.cs+++ b/apps/server/AliasVault.Api/Controllers/V1/AuthController.cs@@ -189,16 +189,16 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserMreturn error;}- await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.Login);-// If 2FA is required, return that status and no JWT token yet.if (user!.TwoFactorEnabled){+ await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.Login);return Ok(new ValidateLoginResponse(true, string.Empty, null));}// Reset failed login attempts.await userManager.ResetAccessFailedCountAsync(user);+ await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.Login);var tokenModel = await GenerateNewTokensForUser(user, extendedLifetime: model.RememberMe);return Ok(new ValidateLoginResponse(false, serverSession!.Proof, tokenModel));@@ -237,10 +237,8 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserM}// Validation of 2-FA token is successful, user is authenticated.- await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.TwoFactorAuthentication);-- // Reset failed login attempts.await userManager.ResetAccessFailedCountAsync(user);+ await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.TwoFactorAuthentication);// Generate and return the JWT token.var tokenModel = await GenerateNewTokensForUser(user, extendedLifetime: model.RememberMe);@@ -284,10 +282,8 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserM}// Recovery code is valid, user is authenticated.- await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.TwoFactorAuthentication);-- // Reset failed login attempts.await userManager.ResetAccessFailedCountAsync(user);+ await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.TwoFactorAuthentication);// Generate and return the JWT token.var tokenModel = await GenerateNewTokensForUser(user, extendedLifetime: model.RememberMe);diff --git a/apps/server/AliasVault.Api/Controllers/V2/AuthController.cs b/apps/server/AliasVault.Api/Controllers/V2/AuthController.csindex 1ff109fd0..2d787ecd8 100644--- a/apps/server/AliasVault.Api/Controllers/V2/AuthController.cs+++ b/apps/server/AliasVault.Api/Controllers/V2/AuthController.cs@@ -135,16 +135,16 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserMreturn error;}- await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.Login);-// If 2FA is required, return that status and no JWT token yet.if (user!.TwoFactorEnabled){+ await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.Login);return Ok(new ValidateLoginResponse(true, string.Empty, null));}// Reset failed login attempts.await userManager.ResetAccessFailedCountAsync(user);+ await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.Login);var tokenModel = await GenerateNewTokensForUser(user, extendedLifetime: model.RememberMe);return Ok(new ValidateLoginResponse(false, serverSession!.Proof, tokenModel));@@ -183,10 +183,8 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserM}// Validation of 2-FA token is successful, user is authenticated.- await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.TwoFactorAuthentication);-- // Reset failed login attempts.await userManager.ResetAccessFailedCountAsync(user);+ await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.TwoFactorAuthentication);// Generate and return the JWT token.var tokenModel = await GenerateNewTokensForUser(user, extendedLifetime: model.RememberMe);@@ -230,10 +228,8 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserM}// Recovery code is valid, user is authenticated.- await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.TwoFactorAuthentication);-- // Reset failed login attempts.await userManager.ResetAccessFailedCountAsync(user);+ await authLoggingService.LogAuthEventSuccessAsync(model.Username, AuthEventType.TwoFactorAuthentication);// Generate and return the JWT token.var tokenModel = await GenerateNewTokensForUser(user, extendedLifetime: model.RememberMe);