/// <summary> /// The validate password. /// </summary> /// <param name="password"> /// The password. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public virtual bool ValidatePassword(string password) { if (string.IsNullOrWhiteSpace(password)) { return(false); } return(this.Password.ToLower() == BitConverter.ToString(Cryptographer.GenerateHash(password)).Replace("-", string.Empty).ToLower()); }
/// <summary> /// The set password. /// </summary> /// <param name="password"> /// The password. /// </param> /// <param name="previousPassword"> /// The previous Password. /// </param> public virtual void SetPassword(string password, string previousPassword) { this.PreviousPassword = string.IsNullOrWhiteSpace(previousPassword) ? "01temp23password45" : previousPassword; this.Password = BitConverter.ToString(Cryptographer.GenerateHash(password)).Replace("-", string.Empty).ToUpper(); this.PlainPassword = password; this.UpdateAC = true; }
public override PasswordVerificationResult VerifyHashedPassword(string hashedPassword, string providedPassword) { string hash = BitConverter.ToString(Cryptographer.GenerateHash(providedPassword)).Replace("-", string.Empty); if (hashedPassword.Equals(hash, StringComparison.OrdinalIgnoreCase)) { return(PasswordVerificationResult.Success); } else { return(PasswordVerificationResult.Failed); } }
/// <summary> /// The set password. /// </summary> /// <param name="password"> /// The password. /// </param> public virtual void SetPassword(string password) { this.Password = BitConverter.ToString(Cryptographer.GenerateHash(password)).Replace("-", string.Empty).ToUpper(); }