From 03faee8d3ac0b83d6833b359d277b81163fe90c7 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Thu, 14 Aug 2025 18:26:07 +0200 Subject: [PATCH] Cleanup unused translations --- apps/browser-extension/src/i18n/locales/en.json | 2 -- apps/mobile-app/i18n/locales/en.json | 2 -- .../AliasVault.Api/Controllers/AuthController.cs | 8 ++++---- .../AliasVault.Client/Resources/ApiErrors.en.resx | 6 ------ .../AliasVault.Shared/Models/Enums/ApiErrorCode.cs | 10 ---------- 5 files changed, 4 insertions(+), 24 deletions(-) diff --git a/apps/browser-extension/src/i18n/locales/en.json b/apps/browser-extension/src/i18n/locales/en.json index e1c1f15a2..001c4fdd3 100644 --- a/apps/browser-extension/src/i18n/locales/en.json +++ b/apps/browser-extension/src/i18n/locales/en.json @@ -109,8 +109,6 @@ "INVALID_AUTHENTICATOR_CODE": "Invalid authenticator code. Please try again.", "INVALID_RECOVERY_CODE": "Invalid recovery code. Please try again.", "REFRESH_TOKEN_REQUIRED": "Refresh token is required.", - "USER_NOT_FOUND_IN_TOKEN": "User not found in token.", - "USER_NOT_FOUND_IN_DATABASE": "User not found in database.", "INVALID_REFRESH_TOKEN": "Invalid refresh token.", "REFRESH_TOKEN_REVOKED_SUCCESSFULLY": "Refresh token revoked successfully.", "PUBLIC_REGISTRATION_DISABLED": "New account registration is currently disabled on this server. Please contact the administrator.", diff --git a/apps/mobile-app/i18n/locales/en.json b/apps/mobile-app/i18n/locales/en.json index 436f26f3e..62e27d012 100644 --- a/apps/mobile-app/i18n/locales/en.json +++ b/apps/mobile-app/i18n/locales/en.json @@ -374,8 +374,6 @@ "INVALID_AUTHENTICATOR_CODE": "Invalid authenticator code. Please try again.", "INVALID_RECOVERY_CODE": "Invalid recovery code. Please try again.", "REFRESH_TOKEN_REQUIRED": "Refresh token is required.", - "USER_NOT_FOUND_IN_TOKEN": "User not found in token.", - "USER_NOT_FOUND_IN_DATABASE": "User not found in database.", "INVALID_REFRESH_TOKEN": "Invalid refresh token.", "REFRESH_TOKEN_REVOKED_SUCCESSFULLY": "Refresh token revoked successfully.", "PUBLIC_REGISTRATION_DISABLED": "New account registration is currently disabled on this server. Please contact the administrator.", diff --git a/apps/server/AliasVault.Api/Controllers/AuthController.cs b/apps/server/AliasVault.Api/Controllers/AuthController.cs index d9aaee0ca..74a5955af 100644 --- a/apps/server/AliasVault.Api/Controllers/AuthController.cs +++ b/apps/server/AliasVault.Api/Controllers/AuthController.cs @@ -296,13 +296,13 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserM var principal = GetPrincipalFromToken(tokenModel.Token); if (principal.FindFirst(ClaimTypes.NameIdentifier)?.Value == null) { - return Unauthorized(ApiErrorCodeHelper.CreateErrorResponse(ApiErrorCode.USER_NOT_FOUND_IN_TOKEN, 401)); + return Unauthorized(ApiErrorCodeHelper.CreateErrorResponse(ApiErrorCode.USER_NOT_FOUND, 401)); } var user = await userManager.FindByIdAsync(principal.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? string.Empty); if (user == null) { - return Unauthorized(ApiErrorCodeHelper.CreateErrorResponse(ApiErrorCode.USER_NOT_FOUND_IN_DATABASE, 401)); + return Unauthorized(ApiErrorCodeHelper.CreateErrorResponse(ApiErrorCode.USER_NOT_FOUND, 401)); } // Check if the account is blocked. @@ -345,13 +345,13 @@ public class AuthController(IAliasServerDbContextFactory dbContextFactory, UserM var principal = GetPrincipalFromToken(model.Token); if (principal.FindFirst(ClaimTypes.NameIdentifier)?.Value == null) { - return Unauthorized(ApiErrorCodeHelper.CreateErrorResponse(ApiErrorCode.USER_NOT_FOUND_IN_TOKEN, 401)); + return Unauthorized(ApiErrorCodeHelper.CreateErrorResponse(ApiErrorCode.USER_NOT_FOUND, 401)); } var user = await userManager.FindByIdAsync(principal.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? string.Empty); if (user == null) { - return Unauthorized(ApiErrorCodeHelper.CreateErrorResponse(ApiErrorCode.USER_NOT_FOUND_IN_DATABASE, 401)); + return Unauthorized(ApiErrorCodeHelper.CreateErrorResponse(ApiErrorCode.USER_NOT_FOUND, 401)); } // Check if the refresh token is valid. diff --git a/apps/server/AliasVault.Client/Resources/ApiErrors.en.resx b/apps/server/AliasVault.Client/Resources/ApiErrors.en.resx index 5956bc387..c76847bd9 100644 --- a/apps/server/AliasVault.Client/Resources/ApiErrors.en.resx +++ b/apps/server/AliasVault.Client/Resources/ApiErrors.en.resx @@ -119,12 +119,6 @@ Refresh token is required. - - User not found (name-1) - - - User not found (name-2) - Your account has been disabled. If you believe this is a mistake, please contact support. diff --git a/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs b/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs index 612ffe41b..892fb0e7a 100644 --- a/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs +++ b/apps/server/Shared/AliasVault.Shared/Models/Enums/ApiErrorCode.cs @@ -19,16 +19,6 @@ public enum ApiErrorCode /// REFRESH_TOKEN_REQUIRED, - /// - /// User not found in the provided token. - /// - USER_NOT_FOUND_IN_TOKEN, - - /// - /// User not found in the database. - /// - USER_NOT_FOUND_IN_DATABASE, - /// /// User account is locked. ///