当前位置: 首页 > article >正文

uniapp uni-id-co errCode“:“uni-id-captcha-required“,“errMsg“:“Captcha required

连续登录失败后就会出现图形验证码校验,如果前端不需要图形验证码校验,uni-id-co文件夹下找到module下的login文件夹下的login.js,注释掉Captcha相关校验,关掉即可

const {preLoginWithPassword,postLogin
} = require('../../lib/utils/login')
const {getNeedCaptcha,verifyCaptcha
} = require('../../lib/utils/captcha')
const {CAPTCHA_SCENE
} = require('../../common/constants')
const {ERROR
} = require('../../common/error')/*** 用户名密码登录* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login* @param {Object} params* @param {String} params.username  用户名* @param {String} params.mobile    手机号* @param {String} params.email     邮箱* @param {String} params.password  密码* @param {String} params.captcha   图形验证码* @returns*/
module.exports = async function (params = {}) {const schema = {username: {required: false,type: 'username'},mobile: {required: false,type: 'mobile'},email: {required: false,type: 'email'},password: 'password',captcha: {required: false,type: 'string'}}this.middleware.validate(params, schema)const {username,mobile,email,password,captcha} = paramsif (!username && !mobile && !email) {throw {errCode: ERROR.INVALID_USERNAME}} else if ((username && email) ||(username && mobile) ||(email && mobile)) {throw {errCode: ERROR.INVALID_PARAM}}// const needCaptcha = await getNeedCaptcha.call(this, {//   username,//   mobile,//   email// })// if (needCaptcha) {//   await verifyCaptcha.call(this, {//     captcha,//     scene: CAPTCHA_SCENE.LOGIN_BY_PWD//   })// }const {user,extraData} = await preLoginWithPassword.call(this, {user: {username,mobile,email},password})return postLogin.call(this, {user,extraData})
}

http://www.lryc.cn/news/2402039.html

相关文章:

  • Github Copilot新特性:Copilot Spaces-成为某个主题的专家
  • React 第五十三节 Router中 useRouteError 的使用详解和案例分析
  • 12分钟讲解主流React库
  • 《doubao-lite-32k 模型缓存机制使用指南》
  • 攻防世界-XCTF-Web安全最佳刷题路线
  • t021-高校物品捐赠管理系统【包含源码材料!!!!】
  • 设计模式——面向对象设计六大原则
  • Python制作史莱姆桌面宠物!可爱的
  • React hook之userReducer
  • Dify源码教程:账户和密码传递分析
  • 如果科技足够发达,是否还需要维持自然系统(例如生物多样性)中那种‘冗余’和‘多样性’,还是可以只保留最优解?
  • 数据分析图表类型及其应用场景
  • 第四十二天打卡
  • Github 2025-06-03Python开源项目日报 Top10
  • Vim查看文件十六进制方法
  • 电脑提示dll文件缺失怎么办 dll修复方法
  • 【自动思考记忆系统】demo (Java版)
  • 【AAOS】【源码分析】用户管理(二)-- 整体架构
  • 51单片机基础部分——独立按键检测
  • 【Docker管理工具】部署Docker可视化管理面板Dpanel
  • Github 2025-06-02 开源项目周报 Top11
  • springboot实现查询学生
  • 深入解析C++五大常用设计模式:原理、实现与应用场景
  • 标识符Symbol和迭代器的实现
  • Appium+python自动化(九)- 定位元素工具
  • Unity 中实现可翻页的 PageView
  • clickhouse常用语句汇总——持续更新中
  • 云计算 Linux Rocky day05【rpm、yum、history、date、du、zip、ln】
  • LuaJIT2.1 和 Lua5.4.8 性能对比
  • 深度学习姿态估计实战:基于ONNX Runtime的YOLOv8 Pose部署全解析