public virtual bool Authenticate(string password) { string hash = Membership.EncodePassword(password, PasswordSalt); if (Password == hash) { return(true); } else { return(false); } }
public User(string name, string email, string password) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException("Nome nao enviado"); } if (string.IsNullOrWhiteSpace(email)) { throw new ArgumentNullException("Email nao enviado"); } if (string.IsNullOrWhiteSpace(password)) { throw new ArgumentNullException("Senha nao enviada"); } PasswordSalt = Membership.GenerateSalt(); Password = Membership.EncodePassword(password, PasswordSalt); Name = name; Email = email; }