Exemplo n.º 1
0
        public ActionResult Index(DirectLinkOptions directLinkOptions, LogOnCredentials data)
        {
            try
            {
                data.Validate();
            }
            catch (RulesException ex)
            {
                ex.Extend(ModelState);
            }

            if (ModelState.IsValid && data.User != null)
            {
                AuthenticationHelper.CompleteAuthentication(data.User);
                if (Request.IsAjaxRequest())
                {
                    return(Json(new
                    {
                        success = true,
                        isAuthenticated = true,
                        userName = data.User.Name
                    }));
                }

                if (directLinkOptions != null && directLinkOptions.IsDefined())
                {
                    return(RedirectToAction("Index", "Home", directLinkOptions));
                }

                return(RedirectToAction("Index", "Home"));
            }

            FillViewBagData();
            return(LogOnView());
        }
Exemplo n.º 2
0
 private void InitViewBag(DirectLinkOptions directLinkOptions)
 {
     ViewBag.AllowSelectCustomerCode = QPConfiguration.AllowSelectCustomerCode;
     ViewBag.CustomerCodes           = QPConfiguration.GetCustomerCodes().Select(c => new QPSelectListItem {
         Text = c, Value = c
     }).OrderBy(n => n.Text);
     ViewBag.AutoLoginLinkQuery = "?UseAutoLogin=false";
     if (directLinkOptions != null && directLinkOptions.IsDefined())
     {
         ViewBag.AutoLoginLinkQuery += "&" + directLinkOptions.ToUrlParams();
     }
 }