public async Task <IActionResult> OnPostAsync() { logger.LogInformation(@"Logging in user with {Email}"); var currentUser = await userRepository.LoginAsync(Email, Password); if (currentUser == null) { InfoText = "There has been an error login you in. Check data and try again"; return(RedirectToPage("/Account/Login")); } logger.LogInformation($"User {Email} logged in at {DateTime.Now}"); await HttpContext.SignInAsync(currentUser.GenerateClaims()); if (!string.IsNullOrEmpty(ReturnUrl)) { return(Redirect(Url.IsLocalUrl(ReturnUrl) ? ReturnUrl : "/")); } logger.LogInformation("Redirecting to default route - index"); return(RedirectToPage("/Info/Index")); }