Ejemplo n.º 1
0
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public async Task <TData <string> > ModifyPwd(UserModifyPwdParam entity)
        {
            TData <string> obj = new TData <string>();

            try
            {
                obj.SetDefault();
                UserEntity userParent = await userService.GetEntity(long.Parse(entity.UserId));

                // LogHelper.Info("【RegUser】 entity:" + JsonHelper.SerializeObject(entity));
                if (userParent != null)
                {
                    LogHelper.Info("【RegUser】 Salt:" + userParent.Salt);
                    if (userParent.Password == EncryptUserPassword(entity.OldPwd, userParent.Salt))
                    {
                        userParent.Salt = GetPasswordSalt();
                        //LogHelper.Info("【RegUser】 Password ==");
                        userParent.Password = EncryptUserPassword(entity.NewPwd, userParent.Salt);
                        //LogHelper.Info("【RegUser】 EncryptUserPassword ==");
                        await userService.ResetPassword(userParent);

                        obj.Tag     = 1;
                        obj.Message = "修改成功";
                    }
                    else
                    {
                        obj.Message = "旧密码错误,不能修改";
                    }
                }
                else
                {
                    obj.Message = "用户不存在";
                }
            }
            catch (Exception ex)
            {
                LogHelper.Info("【RegUser】 ex:" + ex.ToString());
            }
            return(obj);
        }
Ejemplo n.º 2
0
        public async Task <TData <string> > ModifyPwd([FromBody] UserModifyPwdParam entity)
        {
            TData <string> obj = await new UserBLL().ModifyPwd(entity);

            return(obj);
        }