忘记用户密码

2026-11-07 09:43:53
微图
16
最后编辑:微图 于 2026-11-07 09:45:25
分享链接
摘要:活字格忘记用户密码

回复中的前端报错是因为 js 脚本调用 fetch api 过程中 host 是 localhost 而访问的管理控制台登录页是 sql(域名),浏览器会对跨域请求做一定限制,所以二者需要保持一致,但因为这个恢复密码的高风险接口本身要求,调用源必须为 locahost,所以需要参考如下操作流程
1. 访问 localhost 服务管理控制台,如果浏览器地址默认是域名的,手动更改为 localhost 地址
2. F12 打开管理控制台,粘贴对应代码,修改用户名密码,执行脚本


const url = 'http://localhost:22345/UserService/Manager/User/ResetUserPassword';
const data = {
  UserName: "teteet",
  NewPassword: "14444"
};
fetch(url, {
  method: 'POST', // 指定请求方法
  headers: {
    'Content-Type': 'application/json' // 必须告知服务器发送的是 JSON 数据
  },
  body: JSON.stringify(data) // 将 JS 对象转换为 JSON 字符串
})
.then(response => {
  if (response.ok) {
    return response.json(); // 解析返回的 JSON
  }
  throw new Error('网络响应错误');
})
.then(result => {
  console.log('成功:', result);
})
.catch(error => {
  console.error('失败:', error);
});



发表评论
评论通过审核后显示。
  • 在线客服
  • 关注微信
    • 客服帆帆
    • 客服娜娜
    • 客服美美
    • 客服龙龙
  • 扫一扫关注微信