private HipchatUser HipChatLogin(LoginViewModel login) { var service = new HipChatLoginService(); try { var result = service.Login(login.Username, login.Password); return result; } catch(Exception ex) { return null; } }
public ActionResult Login(LoginViewModel login) { if (!ModelState.IsValid) { ViewBag.Error = "Form is not valid; please review and try again."; return View("Login"); } var user = HipChatLogin(login); if (user != null) { FormsAuthentication.RedirectFromLoginPage(user.Id.ToString(), true); } ViewBag.Error = "Credentials invalid. Please try again."; return View("Login"); }