Exemplo n.º 1
0
        /// <summary>
        /// 驗證使用者,若通過驗證則完成簽入動作
        /// </summary>
        /// <returns></returns>
        public bool ValidateUser()
        {
            IDictionary <string, string> conditions = new Dictionary <string, string>();

            conditions.Add("Account", this.Account);
            IList <MasterMember> adminList = m_FTISService.GetMasterMemberListNoLazy(conditions);

            if (adminList != null && adminList.Count() > 0)
            {
                MasterMember admin           = adminList[0];
                string       passwordDecrypt = EncryptUtil.GetMD5(Password);
                if (passwordDecrypt.Equals(admin.Password, StringComparison.OrdinalIgnoreCase))
                {
                    //modelUser = admin;
                    FormsAuthentication.SetAuthCookie(this.Account, this.RememberMe);
                    Ticket.SignIn(this.Account, this.RememberMe, 1);
                    m_SessionHelper.LoginUser = admin;

                    ////登入紀錄
                    MasterLog masterLog = new MasterLog(this.Account, HttpHelper.GetUserIp());
                    m_FTISService.CreateMasterLog(masterLog);

                    return(true);
                }
            }

            return(false);
        }