Skip to content

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

Refactor (#1173)

Leendert de Borsta3552471af09
diff --git a/apps/server/AliasVault.Admin/Main/Components/Alerts/GlobalNotificationDisplay.razor b/apps/server/AliasVault.Admin/Main/Components/Alerts/GlobalNotificationDisplay.razor
index a9e15750c..63f11354e 100644
--- a/apps/server/AliasVault.Admin/Main/Components/Alerts/GlobalNotificationDisplay.razor
+++ b/apps/server/AliasVault.Admin/Main/Components/Alerts/GlobalNotificationDisplay.razor
@@ -82,12 +82,9 @@
{
// We retrieve any additional messages from the GlobalNotificationService that we do not yet have.
var newMessages = GlobalNotificationService.GetMessagesForDisplay();
- foreach (var message in newMessages)
+ foreach (var message in newMessages.Where(message => !Messages.Exists(m => m.Key == message.Key && m.Value == message.Value)))
{
- if (!Messages.Exists(m => m.Key == message.Key && m.Value == message.Value))
- {
- Messages.Add(message);
- }
+ Messages.Add(message);
}
// Remove messages that are no longer in the GlobalNotificationService and have already been displayed.
diff --git a/apps/server/AliasVault.Client/Main/Components/Alerts/GlobalNotificationDisplay.razor b/apps/server/AliasVault.Client/Main/Components/Alerts/GlobalNotificationDisplay.razor
index 70d7cd023..5283611c4 100644
--- a/apps/server/AliasVault.Client/Main/Components/Alerts/GlobalNotificationDisplay.razor
+++ b/apps/server/AliasVault.Client/Main/Components/Alerts/GlobalNotificationDisplay.razor
@@ -71,23 +71,17 @@
bool hasChanges = false;
// Check for new messages
- foreach (var message in newMessages)
+ foreach (var message in newMessages.Where(message => !Messages.Exists(m => m.Key == message.Key && m.Value == message.Value)))
{
- if (!Messages.Exists(m => m.Key == message.Key && m.Value == message.Value))
- {
- Messages.Add(message);
- hasChanges = true;
- }
+ Messages.Add(message);
+ hasChanges = true;
}
// Check for messages to remove
var messagesToRemove = Messages.Where(m => !newMessages.Exists(nm => nm.Key == m.Key && nm.Value == m.Value)).ToList();
- if (messagesToRemove.Any())
+ foreach (var message in messagesToRemove)
{
- foreach (var message in messagesToRemove)
- {
- Messages.Remove(message);
- }
+ Messages.Remove(message);
hasChanges = true;
}
diff --git a/apps/server/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor b/apps/server/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor
index abe7232b1..5a2808a94 100644
--- a/apps/server/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor
+++ b/apps/server/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor
@@ -217,6 +217,10 @@
/// <summary>
/// Bounding client rectangle returned from JavaScript.
/// </summary>
+ /// <remarks>
+ /// Properties are populated via JavaScript interop deserialization.
+ /// SonarCloud warnings are suppressed as these are required for JS interop.
+ /// </remarks>
private sealed class BoundingClientRect
{
public double Left { get; set; }
diff --git a/apps/server/AliasVault.Client/Main/Layout/TopMenu.razor b/apps/server/AliasVault.Client/Main/Layout/TopMenu.razor
index efda66e80..4a77355f7 100644
--- a/apps/server/AliasVault.Client/Main/Layout/TopMenu.razor
+++ b/apps/server/AliasVault.Client/Main/Layout/TopMenu.razor
@@ -189,12 +189,6 @@
}
}
- private void ToggleUserMenu()
- {
- IsUserMenuOpen = !IsUserMenuOpen;
- StateHasChanged();
- }
-
private void ToggleMobileMenu()
{
IsMobileMenuOpen = !IsMobileMenuOpen;
diff --git a/apps/server/AliasVault.Client/Resources/SharedResources.en.resx b/apps/server/AliasVault.Client/Resources/SharedResources.en.resx
index 900b1516a..29c48d9f1 100644
--- a/apps/server/AliasVault.Client/Resources/SharedResources.en.resx
+++ b/apps/server/AliasVault.Client/Resources/SharedResources.en.resx
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
- <!--
- Microsoft ResX Schema
-
+ <!--
+ Microsoft ResX Schema
+
Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
associated with the data types.
-
+
Example:
-
+
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
-
- There are any number of "resheader" rows that contain simple
+
+ There are any number of "resheader" rows that contain simple
name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
-
+
mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
+ value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
-
+
mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
+ value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
+ value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
@@ -117,7 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
-
+
<!-- Common UI elements -->
<data name="Save" xml:space="preserve">
<value>Save</value>
@@ -175,7 +175,7 @@
<value>Refresh</value>
<comment>Button text to refresh content</comment>
</data>
-
+
<!-- Common form elements -->
<data name="Email" xml:space="preserve">
<value>Email</value>
@@ -201,10 +201,6 @@
<value>Title</value>
<comment>Label for title input field</comment>
</data>
- <data name="Notes" xml:space="preserve">
- <value>Notes</value>
- <comment>Label for notes input field</comment>
- </data>
<data name="Website" xml:space="preserve">
<value>Website</value>
<comment>Label for website input field</comment>
@@ -213,7 +209,7 @@
<value>Search</value>
<comment>Label for search input field</comment>
</data>
-
+
<!-- Common error messages -->
<data name="ErrorGeneric" xml:space="preserve">
<value>An error occurred. Please try again.</value>
@@ -235,7 +231,7 @@
<value>Passwords do not match.</value>
<comment>Password confirmation mismatch error</comment>
</data>
-
+
<!-- Common status messages -->
<data name="Success" xml:space="preserve">
<value>Success</value>
@@ -253,13 +249,13 @@
<value>Info</value>
<comment>Information status message</comment>
</data>
-
+
<!-- Loading screen messages -->
<data name="RefreshPageText" xml:space="preserve">
<value>If loading seems stuck, you can click the button below to refresh the page.</value>
<comment>Text shown above refresh button on loading screen</comment>
</data>
-
+
<!-- Validation error messages for forms -->
<data name="ErrorPasswordMinLength" xml:space="preserve">
<value>The new password must be at least 10 characters long.</value>
@@ -293,7 +289,7 @@
<value>Password is required</value>
<comment>Error message when password is required</comment>
</data>
-
+
<!-- General UI text -->
<data name="LockVault" xml:space="preserve">
<value>Lock vault</value>
diff --git a/apps/server/AliasVault.Client/Services/JsInterop/JsInteropService.cs b/apps/server/AliasVault.Client/Services/JsInterop/JsInteropService.cs
index 53c9efcc2..8035d1901 100644
--- a/apps/server/AliasVault.Client/Services/JsInterop/JsInteropService.cs
+++ b/apps/server/AliasVault.Client/Services/JsInterop/JsInteropService.cs
@@ -612,17 +612,17 @@ public sealed class JsInteropService(IJSRuntime jsRuntime)
/// <summary>
/// Gets the derived key.
/// </summary>
- public string? DerivedKey { get; init; }
+ public string? DerivedKey { get; }
/// <summary>
/// Gets the optional error message.
/// </summary>
- public string? Error { get; init; }
+ public string? Error { get; }
/// <summary>
/// Gets the optional additional error details.
/// </summary>
- public string? Message { get; init; }
+ public string? Message { get; }
}
/// <summary>
@@ -633,26 +633,26 @@ public sealed class JsInteropService(IJSRuntime jsRuntime)
/// <summary>
/// Gets the credential ID as a base64 string.
/// </summary>
- public string? CredentialId { get; init; }
+ public string? CredentialId { get; }
/// <summary>
/// Gets the salt as a base64 string.
/// </summary>
- public string? Salt { get; init; }
+ public string? Salt { get; }
/// <summary>
/// Gets the derived key as a base64 string.
/// </summary>
- public string? DerivedKey { get; init; }
+ public string? DerivedKey { get; }
/// <summary>
/// Gets the optional error message.
/// </summary>
- public string? Error { get; init; }
+ public string? Error { get; }
/// <summary>
/// Gets the optional additional error details.
/// </summary>
- public string? Message { get; init; }
+ public string? Message { get; }
}
}