public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link await _SendVerificationEmail(model.Email, user.Id); // create a CRM lead var blCrm = await DomingoUserManager.CreateCrmLeadWebSignup(model.Email, user.Id); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
/// <summary> /// /// </summary> /// <param name="AspNetUserName"></param> /// <returns></returns> public static bool UserEmailVerified(string AspNetUserName) { if (string.IsNullOrEmpty(AspNetUserName)) { return(false); } if (HttpContext.Current.Session["UserEmailVerified"] == null) { var emailVerified = DomingoUserManager.IsUserEmailVerified(AspNetUserName); HttpContext.Current.Session.Add("UserEmailVerified", emailVerified); return(emailVerified); } else if (HttpContext.Current.Session["UserEmailVerified"].ToString().ToUpper() == "TRUE") { return(true); } else if (HttpContext.Current.Session["UserEmailVerified"].ToString().ToUpper() == "FALSE") { var emailVerified = DomingoUserManager.IsUserEmailVerified(AspNetUserName); HttpContext.Current.Session["UserEmailVerified"] = emailVerified; return(emailVerified); } return(false); }
public async Task <ActionResult> CallMeBackMicroAsync(CallMeBackViewModel model) { // create a CRM lead var blCrm = await DomingoUserManager.CreateCrmLeadCallMeBack(model.WhomToCall, model.WhereToCall); ViewBag.ConfirmationMessage = "Our agents will call you back as soon as possible."; return(View("ContactUsThanks")); }
public async Task <ActionResult> SubmitTripRequestAsync(string FIRST_NAME, string LAST_NAME, string EMAIL, string CIRCUIT, string PHONE, string TRIP_REQUEST) { TRIP_REQUEST = string.Format("Circuit requested for: {0} -- User comment: {1}", CIRCUIT, TRIP_REQUEST); var blError = await DomingoUserManager.CreateCrmLeadExternal(FIRST_NAME, LAST_NAME, EMAIL, PHONE, TRIP_REQUEST); return(RedirectToAction("ContactUsThanks")); }
public async Task <ActionResult> DownloadBrochureRequestAsync(_DownloadBrochureRequestModel model) { // create a CRM lead var brochurePath = ConfigurationManager.AppSettings["HostSite"] + model.BrochurePath; var blCrm = await DomingoUserManager.CreateCrmLeadDownloadBrochure(model.Name, model.Email, brochurePath); ViewBag.ConfirmationMessage = "Your brochure has been emailed to you."; return(View("ContactUsThanks")); }
public ActionResult Index() { if (Request.IsAuthenticated) { DomingoUserManager.TraceSession(User.Identity.GetUserName(), "/Home"); } return(View()); }
public async Task <ActionResult> WelcomeNewMemberAsync(NewMemberViewModel model) { _CheckForAdminAccess(); var context = new TravelogyDevEntities1(); var users = context.View_User.Where(p => p.Email == model.Email); if (users == null || users.Count() == 0) { await _SendWelcomeEmail(model.FirstName, model.LastName, model.Email); var _blError = await DomingoUserManager.CreateCrmLeadUserCallin(model.FirstName, model.LastName, model.Email, model.Telephone, model.Notes); } return(RedirectToAction("Index")); }
/// <summary> /// /// </summary> /// <param name="AspNetUserName"></param> /// <returns></returns> public static string GetUserType(string AspNetUserName) { if (string.IsNullOrEmpty(AspNetUserName)) { return(string.Empty); } if (HttpContext.Current.Session["LoggedInUserType"] != null && !string.IsNullOrEmpty(HttpContext.Current.Session["LoggedInUserType"].ToString())) { return(HttpContext.Current.Session["LoggedInUserType"].ToString()); } var userType = DomingoUserManager.GetUserType(AspNetUserName); HttpContext.Current.Session.Add("LoggedInUserType", userType); return(userType); }
public async Task <ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl) { if (User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Manage")); } if (ModelState.IsValid) { // Get the information about the user from the external login provider var info = await AuthenticationManager.GetExternalLoginInfoAsync(); if (info == null) { return(View("ExternalLoginFailure")); } var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user); if (result.Succeeded) { result = await UserManager.AddLoginAsync(user.Id, info.Login); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); await _SendVerificationEmail(model.Email, user.Id); // create a CRM lead var blCrm = DomingoUserManager.CreateCrmLeadWebSignup(model.Email, user.Id); return(RedirectToLocal(returnUrl)); } } AddErrors(result); } ViewBag.ReturnUrl = returnUrl; return(View(model)); }
public async Task <ActionResult> Login(LoginViewModel model, string returnUrl) { if (!ModelState.IsValid) { return(View(model)); } // This doesn't count login failures towards account lockout // To enable password failures to trigger account lockout, change to shouldLockout: true var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false); switch (result) { case SignInStatus.Success: // trace the login await DomingoUserManager.TraceSession(model.Email, "/Account/Login - Success"); return(RedirectToLocal(returnUrl)); case SignInStatus.LockedOut: await DomingoUserManager.TraceSession(model.Email, "/Account/Login - Lockout"); return(View("Lockout")); case SignInStatus.RequiresVerification: return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe })); case SignInStatus.Failure: default: await DomingoUserManager.TraceSession(model.Email, "/Account/Login - Invalid login attempt"); model.LoginFailureMessage = "Sorry your login details do not match!"; ModelState.AddModelError("", "Invalid login attempt."); return(View(model)); } }
public async Task <ActionResult> ContactUsFormSubmitAsync(string FIRST_NAME, string LAST_NAME, string EMAIL, string TRIP_REQUEST, string PHONE) { var blError = await DomingoUserManager.CreateCrmLeadExternal(FIRST_NAME, LAST_NAME, EMAIL, PHONE, TRIP_REQUEST); return(RedirectToAction("ContactUsThanks")); }