Пример #1
0
        public IActionResult SignOn()
        {
            var model = new SignOnModel
            {
                CardId = ""
            };

            return(View(model));
        }
        public ActionResult SignOn(SignOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                bool       allowMultipleSessions = false;
                AppSession appSession            = Global.GetAppSession(this.HttpContext);
                UserEnvironmentStructure ues     = new UserEnvironmentStructure();
                ues.AppCode    = appSession.AppCode;
                ues.AppId      = appSession.AppId;
                ues.AppVersion = appSession.AppVersion;
                SignonResultsStructure results = UserSignon.Signon(Global.GetDataAccessMgr(this.HttpContext)
                                                                   , appSession.SignonControl
                                                                   , model.UserName
                                                                   , model.Password
                                                                   , ues
                                                                   , allowMultipleSessions);

                if (results.ResultEnum == SignonResultsEnum.Success)
                {
                    FormsService.SignIn(model.UserName, model.RememberMe);
                    Session[SessionManagement.Constants.UserSessionMgr] = results.UserSessionMgr;
                    if (!string.IsNullOrEmpty(returnUrl))
                    {
                        string[] urlParts    = returnUrl.Split(new string[] { Constants.UIControlCodeTag }, StringSplitOptions.None);
                        int      controlCode = urlParts.Length > 1 ? Convert.ToInt32(urlParts[1]) : 0;
                        if (!results.UserSessionMgr.IsAccessAllowed(controlCode) || true)
                        {
                            string msg = string.Format("Sorry, you are not authorized to access this page: {0}."
                                                       , urlParts[0]);
                            System.Web.Routing.RouteValueDictionary dictionary = new System.Web.Routing.RouteValueDictionary();
                            dictionary.Add(Constants.Message, msg);
                            dictionary.Add(Constants.UrlReferrer, model.GoBackUri);
                            return(RedirectToAction(Constants.AccessDenied, Constants.Home, dictionary));
                        }
                    }
                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction(Constants.Index, Constants.Home));
                    }
                }
                else
                {
#warning "Add other case conditions"
                    ModelState.AddModelError("", "The user name or password provided is incorrect.");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Пример #3
0
        public ActionResult SignOn(string id)
        {
            SignOnModel model = new SignOnModel();

            model.WebApplicationDisplayName = "Web SSO Viewer";
            model.SignOnAttemptId           = id;
            model.CancelAllowed             = true;
            model.CaptchaRequired           = true;
            model.CaptchaTheme = CaptchaThemes.clean.ToString();

            return(View(model));
        }
Пример #4
0
        public ActionResult SignOnExpress(string id)
        {
            SignOnModel model = new SignOnModel();

            model.WebApplicationDisplayName = "Web SSO Viewer";
            model.SignedInApplications      = new string[] { "Web Application A", "Web Application B" };
            model.SignOnAttemptId           = id;
            model.User              = DemoUser;
            model.DisplayName       = DemoDisplayName;
            model.CancelAllowed     = true;
            model.AutoSignOnAllowed = true;

            return(View(model));
        }
Пример #5
0
        public ActionResult SignOnAdditional(string id)
        {
            SignOnModel model = new SignOnModel();

            model.WebApplicationDisplayName = "Web SSO Viewer";
            model.SignedInApplications      = new string[] { "Web Application A", "Web Application B" };
            model.SignOnAttemptId           = id;
            model.User            = DemoUser;
            model.DisplayName     = DemoDisplayName;
            model.CancelAllowed   = true;
            model.CaptchaRequired = true;
            model.CaptchaTheme    = CaptchaThemes.clean.ToString();

            return(View(model));
        }
Пример #6
0
        public bool CreateUser(SignOnModel model)
        {
            var repository = _unitOfWork.Repository <User>();
            var existUser  = repository.GetQuery().Any(u => u.Email == model.Email);

            if (existUser)
            {
                return(false);
            }
            var entity = new User
            {
                Id          = Guid.NewGuid(),
                UserName    = model.FirstName,
                Platform    = model.Platform,
                Email       = model.Email,
                DisplayName = model.FirstName + model.LastName + model.MiddleName,
            };

            repository.Add(entity);
            _unitOfWork.Commit();
            return(true);
        }
Пример #7
0
        public ActionResult SignOnExpress(string id)
        {
            SignOnModel model = new SignOnModel();
            model.WebApplicationDisplayName = "Web SSO Viewer";
            model.SignedInApplications = new string[] { "Web Application A", "Web Application B" };
            model.SignOnAttemptId = id;
            model.User = DemoUser;
            model.DisplayName = DemoDisplayName;
            model.CancelAllowed = true;
            model.AutoSignOnAllowed = true;

            return View(model);
        }
Пример #8
0
        public ActionResult SignOnAdditional(string id)
        {
            SignOnModel model = new SignOnModel();
            model.WebApplicationDisplayName = "Web SSO Viewer";
            model.SignedInApplications = new string[] { "Web Application A", "Web Application B" };
            model.SignOnAttemptId = id;
            model.User = DemoUser;
            model.DisplayName = DemoDisplayName;
            model.CancelAllowed = true;
            model.CaptchaRequired = true;
            model.CaptchaTheme = CaptchaThemes.clean.ToString();

            return View(model);
        }
Пример #9
0
        public ActionResult SignOn(string id)
        {
            SignOnModel model = new SignOnModel();
            model.WebApplicationDisplayName = "Web SSO Viewer";
            model.SignOnAttemptId = id;
            model.CancelAllowed = true;
            model.CaptchaRequired = true;
            model.CaptchaTheme = CaptchaThemes.clean.ToString();

            return View(model);
        }