Example #1
0
        public ActionResult Enter()
        {
            var actionResult = default(AgileJsonResult);

            var inModel = new Mo.SysUser();

            try
            {
                UpdateModel(inModel);

                var url = Config.PDAUrl;

                var method = AgilePDAMethod.Login;

                var parameter = $"username={inModel.UserName}&password={inModel.Password}";

                var entity = AgilePDASoap.Post(url, method, parameter);

                actionResult.Content = AgileJson.ToJson(entity);

                if (entity.Status == "1")
                {
                    Identity.Login(inModel);
                }
            }
            catch
            {
            }

            return(actionResult);
        }
Example #2
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="email">用户标识</param>
        public static void Login(Mo.SysUser sysUser)
        {
            var cookies = HttpContext.Current.Response.Cookies;
            var user    = new Identity {
                UserName = sysUser.UserName, Password = sysUser.Password, LoginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
            };
            var json = AgileJson.ToJson(user);
            var key  = string.Format("{0}.Identity", Config.CookiePrefix);

            cookies[key].Value = AgileDES.Encrypt(json, Config.SecurityKey);
        }