From 6e1c1ee73089a9bee62700a734ec0d5a886b3d7e Mon Sep 17 00:00:00 2001 From: sudokoko Date: Sat, 6 Jan 2024 23:41:26 -0500 Subject: [PATCH] Prevent placeholder user from being renamed --- .../Maintenance/Commands/RenameUserCommand.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ProjectLighthouse/Administration/Maintenance/Commands/RenameUserCommand.cs b/ProjectLighthouse/Administration/Maintenance/Commands/RenameUserCommand.cs index 67a380b6..8e34051b 100644 --- a/ProjectLighthouse/Administration/Maintenance/Commands/RenameUserCommand.cs +++ b/ProjectLighthouse/Administration/Maintenance/Commands/RenameUserCommand.cs @@ -37,6 +37,13 @@ public class RenameUserCommand : ICommand } } + // prevent the placeholder user from being renamed + if (user.Username.Length == 0) + { + logger.LogError("Cannot rename the placeholder user", LogArea.Command); + return; + } + user.Username = args[1]; await database.SaveChangesAsync();