From 8c51ba83a46bc89c9f35ed414889b7e348e9e8e1 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Wed, 25 Dec 2024 05:44:37 +0300 Subject: [PATCH] fix: add trim for email and username --- Endpoint/Configuration/Model/Admin.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Endpoint/Configuration/Model/Admin.cs b/Endpoint/Configuration/Model/Admin.cs index 26492ec..381981b 100644 --- a/Endpoint/Configuration/Model/Admin.cs +++ b/Endpoint/Configuration/Model/Admin.cs @@ -10,12 +10,22 @@ namespace Mirea.Api.Endpoint.Configuration.Model; public class Admin : ISaveSettings { [JsonIgnore] private const string FileName = "admin.json"; + private string _username = string.Empty; + private string _email = string.Empty; [JsonIgnore] public static string FilePath => PathBuilder.Combine(FileName); - public required string Username { get; set; } - public required string Email { get; set; } + public required string Username + { + get => _username; + set => _username = value.Trim(); + } + public required string Email + { + get => _email; + set => _email = value.Trim(); + } public required string PasswordHash { get; set; } public required string Salt { get; set; } public TwoFactorAuthenticator TwoFactorAuthenticator { get; set; } = TwoFactorAuthenticator.None;