Esempio n. 1
0
        protected override Task <bool> ValidateAsync(string columnName)
        {
            switch (columnName)
            {
            case nameof(UserEmail):
                if (!UserEmail.IsValidEmail())
                {
                    ValidationError = (int)ViewModel.ValidationError.InvalidEmail;
                    return(Task.FromResult(false));
                }
                return(Task.FromResult(true));

            case nameof(Verification):
                if (String.IsNullOrEmpty(Verification))
                {
                    return(Task.FromResult(false));
                }
                return(Task.FromResult(String.Compare(PasswordText, Verification, StringComparison.Ordinal) == 0));

            case nameof(PasswordText):
                return(Task.FromResult(ValidatePassphrasePolicy(PasswordText)));

            default:
                return(Task.FromResult(true));
            }
        }
        private bool ValidateInternal(string columnName)
        {
            switch (columnName)
            {
            case nameof(UserEmail):
                if (!UserEmail.IsValidEmail())
                {
                    ValidationError = (int)ViewModel.ValidationError.InvalidEmail;
                    return(false);
                }
                return(true);

            case nameof(PasswordText):
                return(ValidatePassphrasePolicy(PasswordText));

            case nameof(Verification):
                return(String.Compare(PasswordText, Verification, StringComparison.Ordinal) == 0);

            case nameof(VerificationCode):
                return(VerificationCode.Length == 6 && VerificationCode.ToCharArray().All(c => Char.IsDigit(c)));

            case nameof(ErrorMessage):
                return(ErrorMessage.Length == 0);

            default:
                return(true);
            }
        }
Esempio n. 3
0
        private async Task <bool> ValidatePassphraseForEmailAsync()
        {
            if (!UserEmail.IsValidEmail())
            {
                return(true);
            }

            if (PasswordText.Length > 0 && await IsValidAccountLogOnAsync())
            {
                _nrOfTries = 0;
                return(true);
            }

            _nrOfTries++;
            if (_nrOfTries == MAX_TRIES)
            {
                OnTooManyTries(new EventArgs());
            }

            ValidationError = (int)ViewModel.ValidationError.WrongPassphrase;
            return(false);
        }