public IActionResult Login(string email, string password) { List <string> temp_errors = new List <string>(); if (email == null || password == null) { temp_errors.Add("Enter Email and Password Fields to Login"); TempData["errors"] = temp_errors; return(RedirectToAction("Index")); } //query User check_user = wallFactory.FindEmail(email); if (check_user == null) { temp_errors.Add("Email is not registered"); TempData["errors"] = temp_errors; return(RedirectToAction("Index")); } bool correct = Crypto.VerifyHashedPassword((string)check_user.password, password); if (correct) { HttpContext.Session.SetString("display", "Successfully Logged in!"); HttpContext.Session.SetInt32("current_id", check_user.id); return(RedirectToAction("Dashboard")); } else { temp_errors.Add("Password is not matching"); TempData["errors"] = temp_errors; return(RedirectToAction("Index")); } }