/// <summary> /// 重置密码 /// </summary> /// <param name="request"></param> /// <returns></returns> public UserResetPwdResponse ResetUserPassword(UserResetPwdRequest request) { UserResetPwdResponse response = new UserResetPwdResponse(); if (string.IsNullOrEmpty(request.UserName)) { response.Status = false; response.Message = "用户名为空"; return(response); } if (string.IsNullOrEmpty(request.NewPassword)) { response.Status = false; response.Message = "新密码为空"; return(response); } //解码用户名字符串 var decryptusername = request.UserName.Decrypt(); //将新密码加盐进行md5加密 var salt = UserDal.Instance.GetSaltByUserName(decryptusername); var encryptionPassword = MD5Encrypt.MD5Encrypt32(request.NewPassword + salt); //判断新密码是否和旧密码一致 var uid = UserDal.Instance.CheckPassword(decryptusername, encryptionPassword); if (uid > 0) { response.Status = false; response.Message = "不能使用最近使用过的密码,请重新输入"; return(response); } //调用dal层重置密码方法 int res = UserDal.Instance.ResetUserPasswod(decryptusername, encryptionPassword); //如果res>0修改成功 if (res > 0) { response.Message = "修改成功!"; } else { response.Status = false; response.Message = "修改失败,请检查网络"; } return(response); }
/// <summary> /// 重置密码 /// </summary> /// <returns></returns> public UserResetPwdResponse ResetPassword(UserResetPwdRequest request) { return(ApiRequestHelper.Post <UserResetPwdRequest, UserResetPwdResponse>(request)); }
/// <summary> /// 重置密码 /// </summary> /// <returns></returns> public JsonResult ResetUserPassword(UserResetPwdRequest request) { return(Json(UserBll.Instance.ResetPassword(request), JsonRequestBehavior.AllowGet)); }
public UserResetPwdResponse ResetUserPassword(UserResetPwdRequest request) { return(UserBll.Instance.ResetUserPassword(request)); }