Backend/e-suite.API/eSuite.API/Models/UserProfile.cs

94 lines
2.8 KiB
C#

using System.ComponentModel.DataAnnotations;
using e_suite.API.Common.models;
namespace eSuite.API.Models;
/// <summary>
/// User profile class used by the MVC User profile pages
/// </summary>
public class UserProfile : IPasswordInformation
{
/// <summary>
/// First name
/// </summary>
[Display(Name = "First Name")]
public string? FirstName { get; set; } = string.Empty;
/// <summary>
/// Middle names
/// </summary>
[Display(Name = "Middle Name(s)")]
public string? MiddleNames { get; set; } = string.Empty;
/// <summary>
/// Last name
/// </summary>
[Display(Name = "Last Name")]
public string? LastName { get; set; } = string.Empty;
/// <summary>
/// e-mail address
/// </summary>
[Required]
[EmailAddress]
[Display(Name = "E-Mail")]
public string Email { get; set; } = string.Empty;
/// <summary>
/// new password
/// </summary>
[Display(Name = "New Password")]
[DataType(DataType.Password)]
public string? Password { get; set; } = string.Empty;
/// <summary>
/// new password entered again to ensure that the user hasn't made a mistake
/// </summary>
[Display(Name = "Confirm Password")]
[DataType(DataType.Password)]
[Compare(nameof(Password), ErrorMessage = "Passwords do not match")]
public string? ConfirmPassword { get; set; } = string.Empty;
/// <summary>
/// Using Two factor authentication
/// </summary>
[Display(Name = "Using two factor authentication")]
[Required]
public bool UsingTwoFactorAuthentication { get; set; } = false;
/// <summary>
/// Two factor authentication support settings - QR Code and manual token
/// </summary>
public TwoFactorAuthenticationSettings TwoFactorAuthenticationSettings { get; set; } = null!;
/// <summary>
/// security code generated by authenticator application
/// </summary>
[Display(Name = "Authentication code")]
public string? SecurityCode { get; set; } = null!;
/// <summary>
/// Sso login overridden by this being set
/// </summary>
public long? DomainSsoProviderId { get; set; }
/// <summary>
/// Sso login method. -1 = password and optional 2FA, anything else is from the SsoPrividers list.
/// </summary>
[Display(Name = "Login Method")]
public long SsoProviderId { get; set; } = -1;
/// <summary>
/// SSO user Id
/// </summary>
public string SsoSubject { get; set; } = string.Empty;
/// <summary>
/// List of SSO Providers that the user can select.
/// </summary>
public Dictionary<long, string> SsoProviders { get; set; } = [];
[Display(Name = "Preferred Locale")]
public string PreferredLocale { get; set; }
}