欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 金融 > uniapp uni-id-co errCode“:“uni-id-captcha-required“,“errMsg“:“Captcha required

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

2025/6/9 23:54:39 来源:https://blog.csdn.net/kentturing/article/details/148432304  浏览:    关键词: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})
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词