Exemplo n.º 1
0
    public async Task <IActionResult> Register([FromServices] RegisterViewModelFactory factory, RegisterViewModel viewModel)
    {
        // block a little to avoid brute forcing
        Thread.Sleep(new Random().Next(1000, 3000));

        if (!factory.IsCaptchaValid(viewModel))
        {
            ModelState.AddModelError(nameof(viewModel.CaptchaResult), "Bitte prüfe das Ergebnis dieser Rechnung.");
        }
        if (!ModelState.IsValid)
        {
            factory.ArmCaptcha(viewModel);
            return(View(viewModel));
        }

        await factory.SaveToDatabase(viewModel);

        return(View(viewModel));
    }
Exemplo n.º 2
0
 public async Task <IActionResult> Register([FromServices] RegisterViewModelFactory factory, string?accessToken)
 {
     return(View(await factory.Fill(accessToken)));
 }
Exemplo n.º 3
0
 public async Task <IActionResult> Register([FromServices] RegisterViewModelFactory factory)
 {
     return(await Register(factory, (string?)null));
 }