Beispiel #1
0
        public static void VerifyPassword(this IPasswordForm passwordForm)
        {
            if (String.IsNullOrEmpty(passwordForm.Password))
            {
                throw Error.UserPasswordRequired.Throw();
            }

            if (passwordForm.Password != passwordForm.RetypePassword)
            {
                throw Error.RetypeWrong.Throw();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Ensures that the password form has been filled correctly.
        /// </summary>
        private void ValidatePasswordForm(IPasswordForm form)
        {
            var val = new Validator();

            if (form.Password == null || form.Password.Length < 6)
            {
                val.Add(nameof(form.Password), "Пароль должен содержать как минимум 6 символов.");
            }

            if (form.Password != form.PasswordCopy)
            {
                val.Add(nameof(form.PasswordCopy), "Пароли не совпадают.");
            }

            val.ThrowIfInvalid();
        }
 public KeyboardHooking(IPasswordForm passwordForm, Settings settings)
 {
     _passwordForm = passwordForm;
     _password = settings.Password;
     _instance = Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]).ToInt32();
 }