Exemple #1
0
        public User(string email, HashedPassword hashedPassword, Role role)
        {
            ValidateEmail(email);
            Email = email;

            HashedPassword = hashedPassword ?? throw new IdentityDomainException($"'{nameof(hashedPassword)}' cannot be null");

            Role = role ?? throw new IdentityDomainException($"'{nameof(hashedPassword)}' cannot be null");

            CreatedAt = DateTime.UtcNow;
            UpdatedAt = DateTime.UtcNow;
        }
Exemple #2
0
 public void SetPassword(HashedPassword newPassword)
 {
     HashedPassword = newPassword ?? throw new ArgumentNullException(nameof(newPassword));
     UpdatedAt      = DateTime.UtcNow;
 }