Exemplo n.º 1
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="retrievePwdParam"></param>
        /// <returns></returns>
        public async Task <long> RetrievePwdAsync(RetrievePwdParam retrievePwdParam)
        {
            var user = await CurrentDbContext.SysUsers.FirstAsync(c => c.Email == retrievePwdParam.Email);

            user.PassWord    = retrievePwdParam.Pwd.Md5Encrypt();
            user.UpdatedTime = DateTime.Now;
            user.UpdatedBy   = user.UserId;
            var result = await SaveChangesAsync();

            return(user.UserId);//找回密码 删除token
        }
Exemplo n.º 2
0
        /// <summary>
        /// 找回密码 -- 修改当前用户密码
        /// </summary>
        /// <param name="retrievePwdParam"></param>
        /// <returns></returns>
        public async Task <ResponseModel <bool> > RetrievePwdAsync(RetrievePwdParam retrievePwdParam)
        {
            var result             = new ResponseModel <bool>();
            var verificationResult = await VerificationCaptchaAsync(CacheKeys.RETRIEVEPWDCAPTCHA, retrievePwdParam.Email, retrievePwdParam.Captcha, false);

            if (verificationResult != "验证通过")
            {
                return(result.Fail(verificationResult, false));
            }

            var uid = await SysUserDao.RetrievePwdAsync(retrievePwdParam);

            await LogoutAsync(new UserCacheBo()
            {
                UserId = uid
            });

            return(result.Succeed(true));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> RetrievePwd(RetrievePwdParam retrievePwdParam)
        {
            var result = await UserBll.RetrievePwdAsync(retrievePwdParam);

            return(MyJson(result));
        }