public ActionResult GoogleLogin(string name, string email) { List <string> nameList = name.Split(null).ToList(); string firstName = nameList[0]; string lastName = nameList.Last(); LoginUser user = new LoginUser(); user.Email = email; user.RememberMe = false; bool userRegistered = user.isGoogleUserRegistered(email); if (userRegistered) { FormsAuthentication.SetAuthCookie(user.Email, user.RememberMe); return(RedirectToAction("LoggedIn", "User")); } else { if (ModelState.IsValid) { if (user.RegisterGoogleUser(firstName, lastName, email, guid.ToString())) { FormsAuthentication.SetAuthCookie(user.Email, user.RememberMe); return(RedirectToAction("LoggedIn", "User")); } else { ModelState.AddModelError("", "Login data is incorrect!"); } } else { ModelState.AddModelError("", "Login data is incorrect!"); } //add user to db and redirect to login page } return(View("Login")); }