BCrypt.Net.BCrypt.Verify C# (CSharp) Method

Verify() public static method

Verifies that the hash of the given text matches the provided hash
public static Verify ( string text, string hash ) : bool
text string The text to verify.
hash string The previously-hashed password.
return bool
        public static bool Verify(string text, string hash)
        {
            return hash == HashPassword(text, hash);
        }

Usage Example

Esempio n. 1
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            var validate = context.Suppliers.Where(x => x.Email.Contains(txtEmail.Text)).SingleOrDefault();

            if (string.IsNullOrWhiteSpace(txtEmail.Text) || txtPass.Password.Equals(""))
            {
                MessageBox.Show("Email or Pass is must be filled");
            }
            //else if (!txtEmail.Text.All(char.IsLetterOrDigit))
            //{
            //    MessageBox.Show("*Name Must Contain Only number and text !");
            //}
            //else if (!IsValidEmailRegex(txtEmail.Text))
            else if (!Validate(txtEmail.Text))
            {
                MessageBox.Show("Invalid Email Address");
            }
            else if (validate == null)
            {
                MessageBox.Show("Email not available, you must be register");
            }
            else
            {
                //if (txtEmail.Text != validate.Email && txtPass.Text != validate.Pass)
                if (txtEmail.Text == validate.Email && Bcrypt.Verify(txtPass.Password, validate.Pass) == true)
                {
                    if (validate.Guid.Equals(""))
                    {
                        if (rememberMe.IsChecked == true)
                        {
                            Properties.Settings.Default.Mail     = txtEmail.Text;
                            Properties.Settings.Default.Password = txtPass.Password;
                            Properties.Settings.Default.Save();
                        }
                        MainWindow main = new MainWindow();
                        main.Show();
                    }
                    else
                    {
                        ChangePassWindow changePass = new ChangePassWindow();
                        changePass.getEmail.Text = txtEmail.Text;
                        changePass.Show();
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Email or Pass is wrong");
                }
            }
        }
All Usage Examples Of BCrypt.Net.BCrypt::Verify