Esempio n. 1
0
        /// <summary>
        /// 保存修改后密码信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <OperateStatus> SaveChangePassword(SystemUserChangePasswordInput input)
        {
            var operateStatus = new OperateStatus();

            //后台再次验证是否一致
            if (!input.NewPassword.Equals(input.ConfirmNewPassword))
            {
                operateStatus.Message = "录入的新密码和确认密码不一致。";
                return(operateStatus);
            }
            //旧密码是否正确
            operateStatus = await CheckOldPassword(new CheckSameValueInput { Id = input.Id, Param = input.OldPassword });

            if (operateStatus.ResultSign == ResultSign.Error)
            {
                return(operateStatus);
            }
            //将传入的密码加密
            var encryptPwd = DEncryptUtil.Encrypt(input.NewPassword, _configOptions.Value.PasswordKey);

            if (await _userInfoRepository.ResetPassword(new SystemUserResetPasswordInput
            {
                EncryptPassword = encryptPwd,
                Id = input.Id
            }))
            {
                operateStatus.ResultSign = ResultSign.Successful;
                operateStatus.Message    = string.Format(ResourceSystem.重置密码成功, input.NewPassword);
            }
            return(operateStatus);
        }
Esempio n. 2
0
 public async Task <JsonResult> SaveChangePassword(SystemUserChangePasswordInput input)
 {
     input.Id = _currentUser.UserId;
     return(Json(await _userInfoLogic.SaveChangePassword(input)));
 }