コード例 #1
0
 private Task ConfirmPasswordAsync(SignUpInputContext context)
 {
     if (context.Text != GetText(passwordTitle))
     {
         context.ErrorMessage = "Passwords don't match";
     }
     else
     {
         context.ErrorMessage = null;
     }
     return(Task.CompletedTask);
 }
コード例 #2
0
        private async Task PasswordAsync(SignUpInputContext context)
        {
            if (string.IsNullOrWhiteSpace(context.Text))
            {
                context.ErrorMessage = "Enter a password";
                return;
            }


            if (!Inputs.Any(i => i.Title == confPasswordTitle))
            {
                Inputs.Add(BuildConfPasswordContext());
            }
        }
コード例 #3
0
        private async Task VerifyEmailAsync(SignUpInputContext context)
        {
            context.Text = context.Text.Trim();
            if (string.IsNullOrWhiteSpace(context.Text))
            {
                context.ErrorMessage = "Enter your email";
                return;
            }

            bool exists = await _apiConsumer.VerifyAccountEmailAsync(context.Text);

            if (exists)
            {
                context.ErrorMessage = "There is already an account registered with this account";
            }
            else
            {
                if (!Inputs.Any(i => i.Title == usernameTitle))
                {
                    Inputs.Add(BuildUsernameContext());
                }
            }
        }
コード例 #4
0
        private async Task VerifyUsernameAsync(SignUpInputContext context)
        {
            context.Text = context.Text.Trim();
            if (string.IsNullOrWhiteSpace(context.Text))
            {
                context.ErrorMessage = "Enter a username";
                return;
            }

            bool exists = await _apiConsumer.VerifyAccountUsernameAsync(context.Text);

            if (exists)
            {
                context.ErrorMessage = "Username is taken!";
            }
            else
            {
                if (!Inputs.Any(i => i.Title == passwordTitle))
                {
                    Inputs.Add(BuildPasswordContext());
                }
            }
        }