public static CreateHash ( string password ) : string | ||
password | string | The password to hash. |
return | string |
public void UpdatePassword(string user, string password) { var existingUser = Credentials.SingleOrDefault(c => c.User == user); var passwordHash = PasswordHash.CreateHash(password); if (existingUser == null) { throw new InvalidOperationException("The given user does not exist."); } existingUser.Password = passwordHash; SaveCredentials(); }
public void Create(string user, string password) { if (Credentials.Any(c => c.User == user)) { throw new InvalidOperationException("The given user already exists."); } var passwordHash = PasswordHash.CreateHash(password); m_Credentials.Add(new Credential() { Password = passwordHash, User = user }); SaveCredentials(); }