mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 11:36:33 +00:00
121052a3ef
add security encryption and hashing: WIP add endpoints: register user, get and save resources add db main operations, User entity
22 lines
859 B
C#
22 lines
859 B
C#
using FluentValidation;
|
|
|
|
namespace Azaion.Common.Requests;
|
|
|
|
public class RegisterUserRequest
|
|
{
|
|
public string Email { get; set; } = null!;
|
|
public string Password { get; set; } = null!;
|
|
public RoleEnum Role { get; set; }
|
|
}
|
|
|
|
public class RegisterUserValidator : AbstractValidator<RegisterUserRequest>
|
|
{
|
|
public RegisterUserValidator()
|
|
{
|
|
RuleFor(r => r.Email)
|
|
.MinimumLength(8).WithErrorCode(ExceptionEnum.UserLengthIncorrect.ToString()).WithMessage("Email address should be at least 8 characters.")
|
|
.EmailAddress().WithErrorCode(ExceptionEnum.WrongEmail.ToString()).WithMessage("Email address is not valid.");
|
|
|
|
RuleFor(r => r.Password)
|
|
.MinimumLength(8).WithErrorCode(ExceptionEnum.PasswordLengthIncorrect.ToString()).WithMessage("Password should be at least 8 characters.");
|
|
} } |