Local Passwords validation

This commit is contained in:
Paul Schneider 2024-11-06 13:00:34 +00:00
commit 8132db37d0
163 changed files with 1812 additions and 4772 deletions

View file

@ -1,20 +1,29 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Auth
{
public class Client
{
[Key]
[Key][Required][DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }
[Required]
[MaxLength(128)]
public string DisplayName { get; set; }
public string RedirectUri { get; set; }
[MaxLength(100)]
[MaxLength(512)]
public string? RedirectUri { get; set; }
[MaxLength(512)]
public string LogoutRedirectUri { get; set; }
[MaxLength(512)]
public string Secret { get; set; }
public ApplicationTypes Type { get; set; }
public bool Active { get; set; }
public int RefreshTokenLifeTime { get; set; }
public int AccessTokenLifetime { get; set; }
}
}

View file

@ -4,7 +4,7 @@ using Yavsc.Attributes.Validation;
namespace Yavsc.Models.Messaging
{
public class DimissClicked
public class DismissClicked
{
[YaRequired]
public string UserId { get; set; }
@ -19,4 +19,4 @@ namespace Yavsc.Models.Messaging
public virtual Notification Notified { get; set; }
}
}
}

View file

@ -7,10 +7,10 @@ namespace Yavsc.Models.Relationship
{
public class Contact: IContact
{
[YaRequired()]
[Required()]
public string UserId { get; set; }
[YaRequired()]
[Required()]
public string OwnerId { get; set; }
public string Name { get; set; }
@ -22,10 +22,10 @@ namespace Yavsc.Models.Relationship
public virtual PostalAddress PostalAddress { get; set; }
[ForeignKeyAttribute("OwnerId"),NotMapped]
[ForeignKey("OwnerId"),NotMapped]
public virtual ApplicationUser Owner { get; set; }
[ForeignKeyAttribute("UserId"),NotMapped]
[ForeignKey("UserId"),NotMapped]
public virtual ApplicationUser User { get; set; }
}
}

View file

@ -0,0 +1,12 @@
namespace Yavsc.Models.Relationship
{
public class StaticContact
{
public string Name { get; set; }
public string EMail { get; set; }
public PostalAddress? PostalAddress { get; set; }
}
}

View file

@ -26,12 +26,12 @@ namespace Yavsc
/// Owner's email
/// </summary>
/// <returns></returns>
public Contact Owner { get; set; }
public StaticContact Owner { get; set; }
/// <summary>
/// Administrator's email
/// </summary>
/// <returns></returns>
public Contact Admin { get; set; }
public StaticContact Admin { get; set; }
public string DataDir { get; set; }
public string Avatars { get; set; } = "avatars";

View file

@ -1,13 +1,12 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Account
{
public class ForgotPasswordViewModel
{
[YaRequired]
[YaStringLength(512)]
[Required]
[StringLength(512)]
public string? LoginOrEmail { get; set; }
}
}

View file

@ -5,12 +5,18 @@ namespace Yavsc.ViewModels.Account
{
public class ResetPasswordViewModel
{
[YaRequired]
[Required]
public string Id { get; set; }
[Required]
public string Code { get; set; }
[Required]
[EmailAddress]
public string Email { get; set; }
[YaRequired]
[YaStringLength(100, ErrorMessage = "Le {0} doit être long d'au moins {2} caractères.", MinimumLength = 6)]
[Required]
[StringLength(100, ErrorMessage = "Le {0} doit être long d'au moins {2} caractères.", MinimumLength = 6)]
[DataType(DataType.Password)]
public string Password { get; set; }

View file

@ -1,19 +1,9 @@
namespace Yavsc.ViewModels.Administration
{
public class RoleInfo
{
public RoleInfo ()
{
}
public RoleInfo ( string roleName, string roleId, string[] users)
{
Name = roleName; // role.Name;
Id = roleId; // role.Id;
Users = users ; // role.Users.Select(u => u.UserId).ToArray();
}
public string Id { get; set; }
public string Name { get; set; }
public string[] Users { get; set; }
}
}
{
public string Id { get; set; }
public string Name { get; set; }
public int UserCount { get; set; }
}
}