Esempio n. 1
0
        /// <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());
        }
Esempio n. 2
0
 /// <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;
 }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
 /// <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();
 }