public System.Web.Mvc.ActionResult FinishWizardLater() { var blm = new WizardBrokerLeadModel(Session); ms_oLog.Debug("Broker fill wizard later request: {0}", blm); if (blm.BrokerFillsForCustomer) { StringActionResult sar = null; try { sar = this.m_oServiceClient.Instance.BrokerBackFromCustomerWizard(blm.LeadID); } catch (Exception e) { ms_oLog.Warn(e, "Failed to retrieve broker details, falling back to customer's dashboard."); } // try if (sar == null) { ms_oLog.Debug("Failed to retrieve broker details."); } else { BrokerHelper.SetAuth(null, HttpContext); ms_oLog.Debug("Restoring broker identity after filling customer wizard: '{0}'.", sar.Value); BrokerHelper.SetAuth(sar.Value); blm.Unset(); return(RedirectToAction("Index", "BrokerHome", new { Area = "Broker" })); } // if } // if ms_oLog.Debug("Broker fill wizard later request failed, redirecting back to customer wizard."); blm.Unset(); return(RedirectToAction("Index", "Wizard", new { Area = "Customer" })); } // FinishWizardLater
public JsonResult CustomerCreatePassword(CreatePasswordModel model) { var customerIp = RemoteIp(); if (!ModelState.IsValid) { log.Debug( "Customer create password attempt from remote IP {0}: model state is invalid, list of errors:", customerIp ); foreach (var val in ModelState.Values) { if (val.Errors.Count < 1) { continue; } foreach (var err in val.Errors) { log.Debug("Model value '{0}' with error '{1}'.", val.Value, err.ErrorMessage); } } // for each value log.Debug("End of list of errors."); return(Json(new { success = false, errorMessage = "Failed to set a password.", }, JsonRequestBehavior.AllowGet)); } // if var pu = new PasswordUtility(CurrentValues.Instance.PasswordHashCycleCount); log.Debug( "Customer create password attempt from remote IP {0} received: {1}...", customerIp, pu.Generate(model.UserName, model.Password) ); CustomerOriginEnum origin = UiCustomerOrigin.Get().GetOrigin(); SetPasswordActionResult spar; try { spar = this.serviceClient.Instance.SetCustomerPasswordByToken( model.Token, origin, new DasKennwort(model.Password), new DasKennwort(model.signupPass2), model.IsBrokerLead, customerIp ); } catch (Exception e) { log.Warn(e, "Failed to set new password for user '{0}'.", model.UserName); return(Json(new { success = false, errorMessage = "Failed to set a password.", }, JsonRequestBehavior.AllowGet)); } // try if (!string.IsNullOrWhiteSpace(spar.ErrorMsg)) { log.Warn( "Failed to set a password for user name {0}, error message returned: {1}.", model.UserName, spar.ErrorMsg ); return(Json(new { success = false, errorMessage = spar.ErrorMsg, }, JsonRequestBehavior.AllowGet)); } // if if (spar.UserID <= 0) { log.Warn("Failed to set a password (returned user id is 0) for user name {0}.", model.UserName); return(Json(new { success = false, errorMessage = "Failed to set a password.", }, JsonRequestBehavior.AllowGet)); } // if if (spar.IsBroker) { BrokerHelper.SetAuth(spar.Email); return(Json(new { success = true, errorMessage = string.Empty, broker = true, })); } // if is broker if (spar.SessionID != 0) { Session["UserSessionId"] = spar.SessionID; } if (string.IsNullOrWhiteSpace(spar.ErrorMsg)) { model.SetCookie(LogOnModel.Roles.Customer); this.context.SetSessionOrigin(origin); } // if return(Json(new { success = string.IsNullOrWhiteSpace(spar.ErrorMsg), errorMessage = spar.ErrorMsg, broker = false, }, JsonRequestBehavior.AllowGet)); } // CustomerCreatePassword
public System.Web.Mvc.ActionResult FillWizard(int?nLeadID, string sLeadEmail, string sContactEmail) { nLeadID = nLeadID ?? 0; ms_oLog.Debug( "Broker fill wizard request for contact email {0} and lead id {1} lead email {2}.", sContactEmail, nLeadID, sLeadEmail ); var oIsAuthResult = IsAuth <BrokerForJsonResult>("Send invitation", sContactEmail); if (oIsAuthResult != null) { Session[Constant.Broker.MessageOnStart] = oIsAuthResult.error; Session[Constant.Broker.MessageOnStartSeverity] = Constant.Severity.Error; return(RedirectToAction("Index", "BrokerHome", new { Area = "Broker", })); } // if if ((nLeadID > 0) && !string.IsNullOrWhiteSpace(sLeadEmail)) { ms_oLog.Warn( "Both lead id ({0}) and lead email ({1}) specified while there can be only one.", nLeadID, sLeadEmail ); Session[Constant.Broker.MessageOnStart] = "Could not process fill all the details request."; Session[Constant.Broker.MessageOnStartSeverity] = Constant.Severity.Error; return(RedirectToAction("Index", "BrokerHome", new { Area = "Broker", })); } // if BrokerLeadDetailsActionResult bld; try { bld = this.m_oServiceClient.Instance.BrokerLeadCanFillWizard( nLeadID.Value, sLeadEmail, sContactEmail, UiOrigin ); } catch (Exception e) { ms_oLog.Alert( e, "Failed to process fill wizard request for contact email {0} and lead id {1} lead email {2}.", sContactEmail, nLeadID, sLeadEmail ); Session[Constant.Broker.MessageOnStart] = "Could not process fill all the details request."; Session[Constant.Broker.MessageOnStartSeverity] = Constant.Severity.Error; return(RedirectToAction("Index", "BrokerHome", new { Area = "Broker", })); } // try if (bld.LeadID < 1) { ms_oLog.Warn( "Validated lead id is {0}. Source lead id is {1} lead email {2}.", bld.LeadID, nLeadID, sLeadEmail ); Session[Constant.Broker.MessageOnStart] = "Could not process fill all the details request."; Session[Constant.Broker.MessageOnStartSeverity] = Constant.Severity.Error; return(RedirectToAction("Index", "BrokerHome", new { Area = "Broker", })); } // if this.m_oHelper.Logoff(User.Identity.Name, HttpContext); if (bld.CustomerID > 0) { BrokerHelper.SetAuth(bld.LeadEmail, HttpContext, "Customer"); } // ReSharper disable ObjectCreationAsStatement // This constructor sets Session data. new WizardBrokerLeadModel( Session, bld.LeadID, bld.LeadEmail, bld.FirstName, bld.LastName, true ); // ReSharper restore ObjectCreationAsStatement ms_oLog.Debug( "Broker fill wizard request for contact email {0} and lead id {1} lead email {2} complete.", sContactEmail, nLeadID, sLeadEmail ); return(RedirectToAction("Index", "Wizard", new { Area = "Customer" })); } // FillWizard
public JsonResult Signup(BrokerSignupModel model) { string sReferredBy = ""; if (Request.Cookies.AllKeys.Contains(Constant.SourceRef)) { var oCookie = Request.Cookies[Constant.SourceRef]; if (oCookie != null) { sReferredBy = oCookie.Value; } } // if var uio = UiCustomerOrigin.Get(); ms_oLog.Debug( "Broker sign up request:" + "\n\tFirm name: {0}" + "\n\tFirm reg #: {1}" + "\n\tContact person name: {2}" + "\n\tContact person email: {3}" + "\n\tContact person mobile: {4}" + "\n\tMobile code: {5}" + "\n\tContact person other phone: {6}" + "\n\tFirm web site URL: {7}" + "\n\tCaptcha enabled: {8}" + "\n\tTerms ID: {9}" + "\n\tReferred by (source ref): {10}" + "\n\tFCARegistered: {11}" + "\n\tLicense Number: {12}" + "\n\tUI origin: {13}", model.FirmName, model.FirmRegNum, model.ContactName, model.ContactEmail, model.ContactMobile, model.MobileCode, model.ContactOtherPhone, model.FirmWebSite, model.IsCaptchaEnabled == 0 ? "no" : "yes", model.TermsID, sReferredBy, model.FCARegistered, model.LicenseNumber, uio.CustomerOriginID ); if (!ModelState.IsValid) { return(new BrokerForJsonResult(string.Join( "; ", ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage) ))); } // if if (User.Identity.IsAuthenticated) { ms_oLog.Warn( "Sign up request with contact email {0}: already authorized as {1}.", model.ContactEmail, User.Identity.Name ); return(new BrokerForJsonResult("You are already logged in.")); } // if BrokerPropertiesActionResult bp; try { bp = this.m_oServiceClient.Instance.BrokerSignup( model.FirmName, model.FirmRegNum, model.ContactName, model.ContactEmail, model.ContactMobile, model.MobileCode, model.ContactOtherPhone, new DasKennwort(model.Password), new DasKennwort(model.Password2), model.FirmWebSite, model.IsCaptchaEnabled != 0, model.TermsID, sReferredBy, model.FCARegistered, model.LicenseNumber, uio.CustomerOriginID ); if (!string.IsNullOrEmpty(bp.Properties.ErrorMsg)) { ms_oLog.Warn("Failed to sign up as a broker. {0}", bp.Properties.ErrorMsg); return(new BrokerForJsonResult(bp.Properties.ErrorMsg)); } // if } catch (Exception e) { ms_oLog.Alert(e, "Failed to sign up as a broker."); return(new BrokerForJsonResult("Registration failed. Please contact customer care.")); } // try BrokerHelper.SetAuth(model.ContactEmail); ms_oLog.Debug("Broker sign up succeeded for: {0}", model.ContactEmail); return(new PropertiesBrokerForJsonResult(oProperties: bp.Properties) { antiforgery_token = AntiForgery.GetHtml().ToString() }); } // Signup