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
  } = params
  if (!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
  })
}

引用中的异常信息显示错误码为400,错误消息为"caused: dom name can only have these characters: 0-9a-zA-Z-._:, current: DEFAULT_GROUP@@providers:com.project.api.Api$Iface:1.0.0:" 。 引用中说明了错误码400可能是由于参数请求错误导致的,例如前端组装参数时使用了逗号",",但后台使用Integer进行接收。 引用中展示了一个实现了Api接口的类,其中包括一个get方法。 根据你的问题"ErrCode:-400, ErrMsg:dataId invalid",根据引用中的错误消息,可以推断出是由于dataId不合法导致的。根据引用的内容,无法确定具体的dataId是什么,但可以通过检查dataId是否符合规范来解决此问题。123 #### 引用[.reference_title] - *1* *3* [解决 dubbo在nacos注册出现ErrCode:400, ErrMsg:caused: dom name can only have these characters: 0-9a-...](https://blog.youkuaiyun.com/wuxiong1028/article/details/112984767)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item] - *2* [http 400错误提示解决办法](https://blog.youkuaiyun.com/qq_30434271/article/details/124805818)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item] [ .reference_list ]
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值