Ejemplo n.º 1
0
        public ActionResult Login(UserLoginViewModel vm, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(vm));
            }

            int userId;

            try
            {
                userId = Svc.User.CheckPassword(vm.Account, vm.Password);
                Svc.User.AddSignInRecord(
                    vm.Account,
                    Request.UserHostAddress,
                    "site",
                    "success",
                    string.Empty
                    );
            }
            catch (OrionException ex)
            {
                Svc.User.AddSignInRecord(
                    vm.Account,
                    Request.UserHostAddress,
                    "site",
                    "error",
                    ex.Message
                    );
                throw ex;
            }



            UserDomain     user    = Svc.User.GetById(userId);
            IList <string> actList = Svc.User.GetHoldActList(userId);

            var identity = new OrionUserIdentity
            {
                UserId   = userId,
                UserName = user.UserName,
                Account  = user.Account,
                Name     = user.Account,
            };

            SignInManager.SignIn(identity, actList);


            if (string.IsNullOrWhiteSpace(returnUrl))
            {
                returnUrl = Url.Action("Index", "Home");
            }
            return(Redirect(returnUrl));
        }
Ejemplo n.º 2
0
        /*=================================================================*/



        //
        //[ActAuthorize(ACT.UserEdit, ACT.UserView)]
        public ActionResult Test()
        {
            var user = new OrionUserIdentity
            {
                UserId   = 1,
                UserName = "******",
                Account  = "jax.hu",
                Name     = "jax.hu",
            };

            _signInManager.SignIn(user, new string[] {
                ACT.UserView.ToString(),
                "ProgramView",
                "ProgramInsert",
                "ProgramUpdate",
                "PeoplePicsView",
                "PeoplePicsInsert",
                "SystemMng",
            });


            return(Content("OK " + User.AnyAct(ACT.UserView)));
        }