/// <summary> /// Validates a user and returns the user entity as a result or fails /// and throws a SOAP exception to fail the request. /// </summary> /// <param name="email"></param> /// <param name="password"></param> /// <returns></returns> private User ValidateUser(string email, string password) { busUser busUser = CodePasteFactory.GetUser(); User user = busUser.ValidateUserAndLoad(email, password); if (user == null) { this.ThrowException(busUser.ErrorMessage); } return(user); }
public ActionResult LogOn(string email, string password, bool rememberMe, string returnUrl, bool emailPassword) { if (emailPassword) { if (ModelState.ContainsKey("emailpassword")) { ModelState.Remove("emailpassword"); } return(EmailPassword(email)); } var user = busUser.ValidateUserAndLoad(email, password); if (user == null) { ErrorDisplay.ShowError(busUser.ErrorMessage); return(View(ViewModel)); } AppUserState appUserState = new AppUserState() { Email = user.Email, Name = user.Name, UserId = user.Id, Theme = user.Theme, IsAdmin = user.IsAdmin }; //IssueAuthTicket(appUserState, rememberMe); IdentitySignin(appUserState, user.OpenId, rememberMe); if (!string.IsNullOrEmpty(returnUrl)) { return(Redirect(returnUrl)); } returnUrl = WebUtils.ResolveServerUrl("~/new"); return(Redirect(returnUrl)); //return RedirectToAction("New", "Snippet", null); }