コード例 #1
0
ファイル: AccountService.cs プロジェクト: zhubin168/WebSite
        /// <summary>
        /// 登录认证
        /// </summary>
        /// <param name="loginRQ"></param>
        /// <returns></returns>
        public SysUserList Login(LoginRQ loginRQ)
        {
            var pwd  = DesCryptoUtil.Encrypt(loginRQ.password);
            var data = Wexin_User.Find(string.Format(" Username='******' and Password='******' and RoleId!=0 ", loginRQ.userId, pwd));

            if (data == null)
            {
                return(null);
            }
            return(new SysUserList()
            {
                City = data.City,
                Country = data.Country,
                Create_time = data.Create_time,
                Headimgurl = data.Headimgurl,
                Id = data.Id,
                LoginTime = data.LoginTime,
                Nickname = data.Nickname,
                Open_Id = data.Open_Id,
                Password = data.Password,
                Province = data.Province,
                Remark = data.Remark,
                RoleId = data.RoleId,
                Sex = data.Sex,
                Subscribe_time = data.Subscribe_time,
                TelePhone = data.TelePhone,
                Unionid = data.Unionid,
                Username = data.Username
            });
        }
コード例 #2
0
        public ResultModel <SysUserRS> Login(LoginRQ loginRQ)
        {
            var sysUserRs = new SysUserRS()
            {
                role = "", token = "", userName = ""
            };

            if (loginRQ == null || loginRQ.userId <= 0 || string.IsNullOrWhiteSpace(loginRQ.password))
            {
                return(new ResultModel <SysUserRS> {
                    message = "用户名和密码都不能为空", state = 0, data = sysUserRs
                });
            }
            var user = _service.Login(loginRQ);

            if (user == null)
            {
                return(new ResultModel <SysUserRS> {
                    message = "用户名或密码错误,请重新输入", state = 0, data = sysUserRs
                });
            }

            var accessToken = DesCryptoUtil.Encrypt(loginRQ.userId.ToString());

            sysUserRs.role     = user.RoleId.ToString();
            sysUserRs.userName = user.Username;
            sysUserRs.token    = accessToken;
            sysUserRs.userId   = user.Id;

            return(new ResultModel <SysUserRS> {
                message = "登录成功", state = 1, data = sysUserRs
            });
        }
コード例 #3
0
ファイル: AccountService.cs プロジェクト: zhubin168/WebSite
        /// <summary>
        /// 找回密码
        /// </summary>
        /// <param name="rq"></param>
        /// <returns></returns>
        public bool FindPassword(FindPasswordRQ rq)
        {
            var newEncryptedPassword = DesCryptoUtil.Encrypt(rq.newPassword);
            var user = Wexin_User.Find(new string[] { Wexin_User._.Username, Wexin_User._.TelePhone }, new string[] { rq.saleId, rq.phone });

            if (user == null || user.Id <= 0)
            {
                return(false);
            }
            user.Password = newEncryptedPassword;
            int flag = user.Update();

            return(flag > 0 ? true : false);
        }
コード例 #4
0
 public void WhenCallEncrypt()
 {
     _delegate = () => DesCryptoUtil.Encrypt(_nullText);
 }
コード例 #5
0
 public void WhenCallEncrypt()
 {
     _encryptedText = DesCryptoUtil.Encrypt(_emptyText);
 }
コード例 #6
0
 public void WhenCallEncrypt()
 {
     _encryptedText = DesCryptoUtil.Encrypt(_plainText);
 }