public User(string firstName, string lastName, string email, string password, IEnumerable <Phone> phones = null, DateTime?createdAt = null, DateTime?lastLogin = null) { FirstName = firstName; LastName = lastName; Email = email; CreatedAt = createdAt.HasValue ? createdAt.Value : DateTime.UtcNow; LastLogin = lastLogin; Salt = Guid.NewGuid().ToString(); Password = HashPassService.GenerateSaltedHash(password, Salt); Phones = phones; Validation = new UserValidation().Validate(this); }
public bool isValidPass(string checkPass) { var testPass = HashPassService.GenerateSaltedHash(checkPass, this.Salt); return(HashPassService.CompareByteArrays(this.Password, testPass)); }