Пример #1
0
        }         // SignupCustomerMultiOrigin

        public UserLoginActionResult LoginCustomerMutliOrigin(LoginCustomerMultiOriginModel model)
        {
            LoginCustomerMutliOrigin instance;

            ActionMetaData amd = ExecuteSync(out instance, null, null, model);

            return(new UserLoginActionResult {
                MetaData = amd,
                Status = instance.Status.ToString(),
                SessionID = instance.SessionID,
                ErrorMessage = instance.ErrorMsg,
                RefNumber = instance.RefNumber,
            });
        }         // LoginCustomerMutliOrigin
Пример #2
0
        public JsonResult CustomerLogOn(LogOnModel model)
        {
            string             customerIp = RemoteIp();
            CustomerOriginEnum origin     = UiCustomerOrigin.Get().GetOrigin();

            if (!ModelState.IsValid)
            {
                log.Debug(
                    "Customer log on attempt from remote IP {0} to origin '{1}': model state is invalid, list of errors:",
                    customerIp,
                    origin
                    );

                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 = "User not found or incorrect password."
                }, JsonRequestBehavior.AllowGet));
            }             // if

            var pu = new PasswordUtility(CurrentValues.Instance.PasswordHashCycleCount);

            log.Debug(
                "Customer log on attempt from remote IP {0} received " +
                "with user name '{1}' and hash '{2}' (promotion: {3})...",
                customerIp,
                model.UserName,
                pu.Generate(model.UserName, model.Password),
                model.PromotionDisplayData
                );

            try {
                if (this.brokerHelper.IsBroker(model.UserName))
                {
                    BrokerProperties bp = this.brokerHelper.TryLogin(
                        model.UserName,
                        model.Password,
                        model.PromotionName,
                        model.PromotionPageVisitTime
                        );

                    if ((bp != null) && (bp.CurrentTermsID != bp.SignedTermsID))
                    {
                        Session[Constant.Broker.Terms]   = bp.CurrentTerms;
                        Session[Constant.Broker.TermsID] = bp.CurrentTermsID;
                    }                     // if

                    return(Json(new {
                        success = (bp != null),
                        errorMessage = (bp == null) ? "User not found or incorrect password." : string.Empty,
                        broker = true,
                    }));
                }                 // if is broker
            } catch (Exception e) {
                log.Warn(
                    e,
                    "Failed to check whether '{0}' is a broker login at origin '{1}', continuing as a customer.",
                    model.UserName,
                    origin
                    );
            }             // try

            var loginModel = new LoginCustomerMultiOriginModel {
                UserName               = model.UserName,
                Origin                 = origin,
                Password               = new DasKennwort(model.Password),
                PromotionName          = model.PromotionName,
                PromotionPageVisitTime = model.PromotionPageVisitTime,
                RemoteIp               = customerIp,
            };

            UserLoginActionResult ular = this.serviceClient.Instance.LoginCustomerMutliOrigin(loginModel);

            if (MembershipCreateStatus.Success.ToString() == ular.Status)
            {
                model.SetCookie(LogOnModel.Roles.Customer);
                this.context.SetSessionOrigin(origin);
                return(Json(new { success = true, model, }, JsonRequestBehavior.AllowGet));
            }             // if

            // If we got this far, something failed, redisplay form
            return(Json(new { success = false, errorMessage = ular.ErrorMessage }, JsonRequestBehavior.AllowGet));
        }         // CustomerLogOn
Пример #3
0
 public LoginCustomerMutliOrigin(LoginCustomerMultiOriginModel model)
 {
     this.model  = model;
     this.spLoad = new CustomerLoadLoginData(this);
 }         // constructor