From f262646dba4d37b56746be75ffaac96283134102 Mon Sep 17 00:00:00 2001 From: Elijah R Date: Fri, 5 Apr 2024 09:12:49 -0400 Subject: [PATCH] fix bug where password can become blank --- CollabVMAuthServer/Routes.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CollabVMAuthServer/Routes.cs b/CollabVMAuthServer/Routes.cs index 6e3548a..74fb70e 100644 --- a/CollabVMAuthServer/Routes.cs +++ b/CollabVMAuthServer/Routes.cs @@ -66,7 +66,7 @@ public static class Routes }, Utilities.JsonSerializerOptions); } // Validate new username - if (!string.IsNullOrWhiteSpace(payload.username)) + if (payload.username != null) { if (!Utilities.ValidateUsername(payload.username)) { @@ -89,7 +89,7 @@ public static class Routes } } // Validate new E-Mail - if (!string.IsNullOrWhiteSpace(payload.email)) + if (payload.email != null) { if (!new EmailAddressAttribute().IsValid(payload.email)) { @@ -120,7 +120,7 @@ public static class Routes } } // Validate new password - if (!string.IsNullOrWhiteSpace(payload.newPassword)) + if (payload.newPassword != null) { if (!Utilities.ValidatePassword(payload.newPassword)) { @@ -141,7 +141,7 @@ public static class Routes } // Check for duplicate changes if (payload.username == user.Username || payload.email == user.Email || - Argon2.Verify(user.Password, payload.newPassword)) + (payload.newPassword != null && Argon2.Verify(user.Password, payload.newPassword))) { return Results.Json(new UpdateResponse {