Exemple #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }
            string           pass     = (string)value;
            PasswordStrength strength = PasswordStrengthUtils.CalculatePasswordStrength(pass);

            switch (strength)
            {
            case PasswordStrength.Invalid: return("Transparent");

            case PasswordStrength.VeryWeak: return("Red");

            case PasswordStrength.Weak: return("Orange");

            case PasswordStrength.Average: return("Yellow");

            case PasswordStrength.Strong: return("YellowGreen");

            case PasswordStrength.VeryStrong: return("Green");

            default: return("Gray");
            }
        }
Exemple #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }
            string           pass     = (string)value;
            PasswordStrength strength = PasswordStrengthUtils.CalculatePasswordStrength(pass);

            return(strength.ToString());
        }
Exemple #3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }
            string           pass     = (string)value;
            PasswordStrength strength = PasswordStrengthUtils.CalculatePasswordStrength(pass);

            switch (strength)
            {
            case PasswordStrength.VeryWeak: return(20);

            case PasswordStrength.Weak: return(40);

            case PasswordStrength.Average: return(60);

            case PasswordStrength.Strong: return(80);

            case PasswordStrength.VeryStrong: return(100);

            default: return(0);
            }
        }