From 3546f60f4f9bc7abc031bd4e5809e862b0ee7025 Mon Sep 17 00:00:00 2001 From: sudokoko Date: Fri, 31 May 2024 18:26:08 -0400 Subject: [PATCH] Disallow forced email verification of users with no email --- .../Controllers/Admin/AdminUserController.cs | 2 +- ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs index 42626944..0aada8fc 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs @@ -103,7 +103,7 @@ public class AdminUserController : ControllerBase UserEntity? targetedUser = await this.database.Users.FirstOrDefaultAsync(u => u.UserId == id); if (targetedUser == null) return this.NotFound(); - if (user.EmailAddressVerified) return this.NotFound(); + if (user.EmailAddress == null || user.EmailAddressVerified) return this.NotFound(); List tokens = await this.database.EmailVerificationTokens .Where(t => t.UserId == targetedUser.UserId) diff --git a/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml index e1b6fe78..33a07af1 100644 --- a/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml @@ -333,11 +333,11 @@ else } - @if (!Model.ProfileUser.EmailAddressVerified) + @if (Model.ProfileUser.EmailAddress != null && !Model.ProfileUser.EmailAddressVerified) { - Force Verify Email + Forcibly Verify Email }