public async Task <ActionResult> LoginTwitterComplete(RegisterOpenAuthModel model) { if (!ModelState.IsValid) { return(View(model)); } try { var user = Data.CreateTwitter(model.AccessToken, model.UserName, model.Email ?? string.Empty, model.TwitterId, model.TwitterName, Hostname, WebHelper.GetInterfaceCultureName(Request)); await SetAuthCookieAsync(user.Name, false); return(RedirectToAction("Index", "Home")); } catch (UserNameAlreadyExistsException) { ModelState.AddModelError("UserName", ViewRes.User.CreateStrings.UsernameTaken); return(View(model)); } catch (UserEmailAlreadyExistsException) { ModelState.AddModelError("Email", ViewRes.User.CreateStrings.EmailTaken); return(View(model)); } catch (InvalidEmailFormatException) { ModelState.AddModelError("Email", ViewRes.User.MySettingsStrings.InvalidEmail); return(View(model)); } }
public ActionResult LoginTwitterComplete(RegisterOpenAuthModel model) { if (ModelState.IsValid) { var user = Service.CreateTwitter(model.AccessToken, model.UserName, model.Email ?? string.Empty, model.TwitterId, model.TwitterName, Hostname); if (HandleCreate(user)) { return(RedirectToAction("Index", "Home")); } } return(View(model)); }