fix: add trim for email and username

This commit is contained in:
Polianin Nikita 2024-12-25 05:44:37 +03:00
parent 9ff0f51e19
commit 8c51ba83a4

View File

@ -10,12 +10,22 @@ namespace Mirea.Api.Endpoint.Configuration.Model;
public class Admin : ISaveSettings public class Admin : ISaveSettings
{ {
[JsonIgnore] private const string FileName = "admin.json"; [JsonIgnore] private const string FileName = "admin.json";
private string _username = string.Empty;
private string _email = string.Empty;
[JsonIgnore] [JsonIgnore]
public static string FilePath => PathBuilder.Combine(FileName); public static string FilePath => PathBuilder.Combine(FileName);
public required string Username { get; set; } public required string Username
public required string Email { get; set; } {
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 PasswordHash { get; set; }
public required string Salt { get; set; } public required string Salt { get; set; }
public TwoFactorAuthenticator TwoFactorAuthenticator { get; set; } = TwoFactorAuthenticator.None; public TwoFactorAuthenticator TwoFactorAuthenticator { get; set; } = TwoFactorAuthenticator.None;