using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Abp.Auditing; using Abp.Extensions; using VberAdmin.Validation; using VberZero.BaseSystem.Users; namespace VberAdmin.Web.Models.Account; public class RegisterViewModel : IValidatableObject { [Required] [StringLength(User.MaxNameLength)] public string Name { get; set; } [Required] [StringLength(User.MaxSurnameLength)] public string Surname { get; set; } [StringLength(User.MaxUserNameLength)] public string UserName { get; set; } [Required] [EmailAddress] [StringLength(User.MaxEmailAddressLength)] public string EmailAddress { get; set; } [StringLength(User.MaxPlainPasswordLength)] [DisableAuditing] public string Password { get; set; } public bool IsExternalLogin { get; set; } public string ExternalLoginAuthSchema { get; set; } public IEnumerable Validate(ValidationContext validationContext) { if (!UserName.IsNullOrEmpty()) { if (!UserName.Equals(EmailAddress) && ValidationHelper.IsEmail(UserName)) { yield return new ValidationResult("Username cannot be an email address unless it's the same as your email address!"); } } } }