Advertisement
Guest User

Untitled

a guest
Jul 6th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. var signupModel = new SignupCustomerMultiOriginModel {
  2. UserName = EMail,
  3. Origin = uiOrigin.GetOrigin(),
  4. RawPassword = new DasKennwort(signupPass1),
  5. RemoteIp = this.GetRemoteIP(),
  6. FirstName = FirstName,
  7. LastName = Surname,
  8. CaptchaMode = isInCaptchaMode == "True",
  9. MobilePhone = mobilePhone,
  10. MobileVerificationCode = mobileCode,
  11. BrokerFillsForCustomer = blm.BrokerFillsForCustomer,
  12. WhiteLabelID = whiteLabelId,
  13. IsTest = (Request.Cookies["istest"] != null) ? true : (bool?)null,
  14. CampaignSourceRef = campaignSourceRef,
  15. GoogleCookie = blm.BrokerFillsForCustomer ? string.Empty : GetAndRemoveCookie("__utmz"),
  16. ReferenceSource = blm.BrokerFillsForCustomer ? "Broker" : GetAndRemoveCookie("sourceref"),
  17. AlibabaID = blm.BrokerFillsForCustomer ? null : GetAndRemoveCookie("alibaba_id"),
  18. ABTesting = GetAndRemoveCookie("ezbobab"),
  19. VisitTimes = visitTimes,
  20. FirstVisitTime = HttpUtility.UrlDecode(visitTimes),
  21. RequestedLoanAmount = GetAndRemoveCookie("loan_amount"),
  22. RequestedLoanTerm = GetAndRemoveCookie("loan_period"),
  23. BrokerLeadID = blm.LeadID,
  24. BrokerLeadEmail = blm.LeadEmail,
  25. BrokerLeadFirstName = blm.FirstName,
  26. TypeOfBusiness = nBusinessType
  27. };
  28.  
  29. log.Debug(
  30. "Sign up client attempt id: '{0}', model is {1}.",
  31. uniqueID,
  32. signupModel.ToLogStr()
  33. );
  34.  
  35. try {
  36. log.Debug("Sign up client attempt id: '{0}', requesting backend sign up.", uniqueID);
  37.  
  38. UserLoginActionResult signupResult = this.serviceClient.Instance.SignupCustomerMultiOrigin(signupModel);
  39.  
  40. log.Debug("Sign up client attempt id: '{0}', backend sign up complete.", uniqueID);
  41.  
  42. MembershipCreateStatus status = (MembershipCreateStatus)Enum.Parse(
  43. typeof(MembershipCreateStatus),
  44. signupResult.Status
  45. );
  46.  
  47. log.Debug("Sign up client attempt id: '{0}', status is {1}.", uniqueID, status);
  48.  
  49. if (status == MembershipCreateStatus.DuplicateEmail) {
  50. return Json(
  51. new {
  52. success = false,
  53. errorMessage = signupResult.ErrorMessage,
  54. },
  55. JsonRequestBehavior.AllowGet
  56. );
  57. } // if
  58.  
  59. if (status == MembershipCreateStatus.InvalidAnswer) {
  60. return Json(
  61. new {
  62. success = false,
  63. errorMessage = DbStrings.InvalidMobileCode,
  64. },
  65. JsonRequestBehavior.AllowGet
  66. );
  67. } // if
  68.  
  69. if ((status != MembershipCreateStatus.Success) || !string.IsNullOrWhiteSpace(signupResult.ErrorMessage)) {
  70. throw new Exception(string.IsNullOrWhiteSpace(signupResult.ErrorMessage)
  71. ? string.Format("Failed to sign up (error code is '{0}').", uniqueID)
  72. : signupResult.ErrorMessage
  73. );
  74. } // if
  75.  
  76. ObjectFactory.GetInstance<IEzbobWorkplaceContext>().SessionId =
  77. signupResult.SessionID.ToString(CultureInfo.InvariantCulture);
  78.  
  79. Session["UserSessionId"] = signupResult.SessionID;
  80.  
  81. this.context.SetSessionOrigin(uiOrigin.GetOrigin());
  82. FormsAuthentication.SetAuthCookie(EMail, false);
  83. HttpContext.User = new GenericPrincipal(new GenericIdentity(EMail), new[] { "Customer" });
  84.  
  85. RemoveCookiesOnSignup();
  86.  
  87. log.Debug("Sign up client attempt id: '{0}', sign up complete.", uniqueID);
  88.  
  89. return Json(
  90. new {
  91. success = true,
  92. antiforgery_token = AntiForgery.GetHtml().ToString(),
  93. refNumber = signupResult.RefNumber,
  94. },
  95. JsonRequestBehavior.AllowGet
  96. );
  97. } catch (Exception e) {
  98. log.Alert(e, "Failed to sign up, client attempt id: {0}.", uniqueID);
  99.  
  100. return Json(
  101. new {
  102. success = false,
  103. errorMessage = string.Format(
  104. "Failed to sign up, please call support (error code is '{0}').",
  105. uniqueID
  106. ),
  107. },
  108. JsonRequestBehavior.AllowGet
  109. );
  110. } // try
  111. } // SignUp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement