Пример #1
0
        public void IsPasswordPwned_(string password, bool isPwned)
        {
            var pwned         = new HaveIBeenPwned.Password.HaveIBeenPwned(2500000);
            var isPwnedResult = pwned.IsPasswordPwned(password);

            Assert.Equal(isPwned, isPwnedResult);
        }
Пример #2
0
        public ActionResult Check(string password_strength)
        {
            StrengthCheck temp = new StrengthCheck();

            if (password_strength == null)
            {
                Response.Write("<script> alert ('Please enter a password');</script>");
            }
            var pwned = new HaveIBeenPwned.Password.HaveIBeenPwned();   //Searched database

            bool isPasswordLeaked = pwned.IsPasswordPwned(password_strength);

            if (isPasswordLeaked == true)
            {
                temp.Leaked = "This password has been leaked, it has been compromised and is very unsecure!";
            }
            else
            {
                temp.Leaked = "This password has no known leaks";
            }
            ViewBag.Return = temp.Leaked;
            return(View("Index"));
        }
Пример #3
0
        public void IsPasswordPwned_default(string password, bool isPwned)
        {
            var isPwnedResult = _haveIBeenPwned.IsPasswordPwned(password);

            Assert.Equal(isPwned, isPwnedResult);
        }