Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Refactor (#192)

Leendert de Borst9d0fc082c048
diff --git a/src/AliasVault.Api/Controllers/AuthController.cs b/src/AliasVault.Api/Controllers/AuthController.cs
index 1b7eda831..468bda242 100644
--- a/src/AliasVault.Api/Controllers/AuthController.cs
+++ b/src/AliasVault.Api/Controllers/AuthController.cs
@@ -248,7 +248,7 @@ public class AuthController(IDbContextFactory<AliasServerDbContext> dbContextFac
}
// Check if the refresh token is valid.
- var existingToken = context.AliasVaultUserRefreshTokens.FirstOrDefault(t => t.UserId == user.Id && t.Value == tokenModel.RefreshToken);
+ var existingToken = await context.AliasVaultUserRefreshTokens.FirstOrDefaultAsync(t => t.UserId == user.Id && t.Value == tokenModel.RefreshToken);
if (existingToken == null || existingToken.ExpireDate < timeProvider.UtcNow)
{
await authLoggingService.LogAuthEventFailAsync(user.UserName!, AuthEventType.TokenRefresh, AuthFailureReason.InvalidRefreshToken);
@@ -536,8 +536,6 @@ public class AuthController(IDbContextFactory<AliasServerDbContext> dbContextFac
{
await using var context = await dbContextFactory.CreateDbContextAsync();
- var accessToken = GenerateJwtToken(user);
-
await _semaphore.WaitAsync();
try
{
diff --git a/src/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs b/src/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs
index eef1e963a..e0028a333 100644
--- a/src/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs
+++ b/src/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs
@@ -5,7 +5,10 @@
// </copyright>
//-----------------------------------------------------------------------
-// Run tests in parallel with a maximum of 2 parallel tests.
+// Run tests in parallel with a maximum of 1 parallel tests (= not parallel).
+// Increasing the level of parallelism can lead to concurrency issues especially
+// when running tests through GitHub Actions where the retry will take
+// longer to complete as opposed to running just one test at a time.
[assembly: LevelOfParallelism(1)]
namespace AliasVault.E2ETests.Common;
diff --git a/src/Utilities/AliasVault.Auth/IpAddressUtility.cs b/src/Utilities/AliasVault.Auth/IpAddressUtility.cs
index b60af2f09..f62d811bd 100644
--- a/src/Utilities/AliasVault.Auth/IpAddressUtility.cs
+++ b/src/Utilities/AliasVault.Auth/IpAddressUtility.cs
@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Http;
/// <summary>
/// Ip address utility class to extract IP address from HttpContext.
/// </summary>
-public class IpAddressUtility
+public static class IpAddressUtility
{
/// <summary>
/// Extract IP address from HttpContext.