示例#1
0
        /// <summary>登录</summary>
        /// <param name="name"></param>
        /// <param name="password"></param>
        /// <param name="rememberme">是否记住密码</param>
        /// <returns></returns>
        public override IManageUser Login(String name, String password, Boolean rememberme)
        {
            var user = UserX.Login(name, password, rememberme);

            Current = user;

            var expire = TimeSpan.FromMinutes(0);

            if (rememberme && user != null)
            {
                expire = TimeSpan.FromDays(365);
            }
            else
            {
                var set = Setting.Current;
                if (set.SessionTimeout > 0)
                {
                    expire = TimeSpan.FromSeconds(set.SessionTimeout);
                }
            }

            var context = Context?.HttpContext;

            this.SaveCookie(user, expire, context);

            return(user);
        }