Exemple #1
0
 public ActionResult Login(LoginModel loginModel)
 {
     if (ModelState.IsValid)
     {
         //try and get a token
         string TokenAttempt = APIHelper.CheckToken(loginModel);
         if (TokenAttempt == "error")
         {
             ViewBag.errorMessage = "There was a problem with your login attempt";
         }
         else
         {
             PersonModel Person = APIHelper.GetPersonFromLogin(loginModel);
             //check if person needs to go to onboarding or dashboard
             if (Person.FinishedOnboarding == false)
             {
                 return(RedirectToAction("Index", controllerName: "Welcome"));
             }
             else
             {
                 return(RedirectToAction("Index", controllerName: "MainContent"));
             }
         }
     }
     return(View("Index", loginModel));
 }