public IActionResult Login(LoginViewModel model) { if (ModelState.IsValid) { LoginViewModel UserLogin = _context.LoginUser(model); bool successfulLogin = UserLogin.SuccessfulLogin; if (successfulLogin) { TempData["LoginID"] = model.UserID; TempData["LoginEmail"] = model.UserEmail; _context.LogAction("Login", "Login successful.", model); return(RedirectToAction("Send2FA")); } else { TempData["Status"] = "Invalid username or password entered. Please try again."; _context.LogAction("Login", "Login failed. Invalid password entered for user.", model); return(View()); } } return(View()); }