/// <summary> /// Action invoked to complete link up of an existing customer with an external identity. /// </summary> /// <returns>View for entering activation code to finalize account link up.</returns> public async Task <ActionResult> FinalizeAccountLinkUp() { string emailAddressOfExistingCustomer = this.Request.Form["Email"]; string activationCode = this.Request.Form["ActivationCode"]; if (string.IsNullOrEmpty(emailAddressOfExistingCustomer) || string.IsNullOrEmpty(activationCode)) { var message = "Both the email address and associated activation code must be provided."; RetailLogger.Log.OnlineStoreInvalidAccountLinkUpRequest(Utilities.GetMaskedEmailAddress(emailAddressOfExistingCustomer), activationCode, new NotSupportedException(message)); CustomerLinkUpPendingViewModel viewModel = new CustomerLinkUpPendingViewModel() { ErrorMessage = message, EmailAddressOfExistingCustomer = emailAddressOfExistingCustomer, ActivationCode = activationCode }; return(this.View(SignInController.UserPendingActivationViewName, viewModel)); } LinkToExistingCustomerResult result; try { RetailOperationsHandler retailOperationsHandler = new RetailOperationsHandler(ServiceUtilities.GetEcommerceContext(this.HttpContext)); result = await retailOperationsHandler.FinalizeLinkToExistingCustomer(emailAddressOfExistingCustomer, activationCode); } catch (Exception ex) { RetailLogger.Log.OnlineStoreInvalidAccountLinkUpRequest(Utilities.GetMaskedEmailAddress(emailAddressOfExistingCustomer), activationCode, ex); var message = "We were unable to process this activation code. Please try entering the code again."; CustomerLinkUpPendingViewModel viewModel = new CustomerLinkUpPendingViewModel() { ErrorMessage = message, EmailAddressOfExistingCustomer = emailAddressOfExistingCustomer, ActivationCode = activationCode }; return(this.View(SignInController.UserPendingActivationViewName, viewModel)); } this.TempData["IsActivationFlow"] = true; this.TempData["ActivatedEmail"] = result.EmailAddress; this.TempData["IdProvider"] = GetAuthenticationProviderName(result.ExternalIdentityProvider); var authProviders = SignInController.GetAuthenticationProviders(this.HttpContext); return(this.RedirectToAction(SignInController.DefaultActionName, SignInController.ControllerName)); }
public ActionResult AccountLinkUpPending() { CustomerLinkUpPendingViewModel viewModel = new CustomerLinkUpPendingViewModel(); bool isSignUpFlow = (bool)(this.TempData["IsSignUpFlow"] ?? false); if (isSignUpFlow) { string maskedEmailAddressOfExistingCustomer = (string)(this.TempData["MaskedEmail"] ?? string.Empty); string message = string.Format("Congratulations! We were able to locate your account, and have sent an activation code to {0}.", maskedEmailAddressOfExistingCustomer); viewModel.Messages = new string[] { message }; } else { viewModel.EmailAddressOfExistingCustomer = this.Request.QueryString["email"]; viewModel.ActivationCode = this.Request.QueryString["code"]; } return(this.View(SignInController.UserPendingActivationViewName, viewModel)); }