提交 34cbebfd 编写于 作者: C chenruilong

fix(uni-id-co): requestAuthSecret 缺少为空判断

上级 f0de2a63
...@@ -38,7 +38,8 @@ const ERROR = { ...@@ -38,7 +38,8 @@ const ERROR = {
UNBIND_PASSWORD_NOT_EXISTS: 'uni-id-unbind-password-not-exists', UNBIND_PASSWORD_NOT_EXISTS: 'uni-id-unbind-password-not-exists',
UNBIND_MOBILE_NOT_EXISTS: 'uni-id-unbind-mobile-not-exists', UNBIND_MOBILE_NOT_EXISTS: 'uni-id-unbind-mobile-not-exists',
UNSUPPORTED_REQUEST: 'uni-id-unsupported-request', UNSUPPORTED_REQUEST: 'uni-id-unsupported-request',
ILLEGAL_REQUEST: 'uni-id-illegal-request' ILLEGAL_REQUEST: 'uni-id-illegal-request',
CONFIG_FIELD_REQUIRED: 'uni-id-config-field-required'
} }
function isUniIdError (errCode) { function isUniIdError (errCode) {
......
...@@ -43,7 +43,8 @@ const sentence = { ...@@ -43,7 +43,8 @@ const sentence = {
'uni-id-unbind-mobile-not-exists': 'This is the only way to login at the moment, please bind your phone number and then try to unbind', 'uni-id-unbind-mobile-not-exists': 'This is the only way to login at the moment, please bind your phone number and then try to unbind',
'uni-id-unbind-password-not-exists': 'Please set a password first', 'uni-id-unbind-password-not-exists': 'Please set a password first',
'uni-id-unsupported-request': 'Unsupported request', 'uni-id-unsupported-request': 'Unsupported request',
'uni-id-illegal-request': 'Illegal request' 'uni-id-illegal-request': 'Illegal request',
'uni-id-config-field-required': 'Config field required: {field}'
} }
module.exports = { module.exports = {
......
...@@ -45,7 +45,8 @@ const sentence = { ...@@ -45,7 +45,8 @@ const sentence = {
'uni-id-unbind-mobile-not-exists': '这是当前唯一登录方式,请绑定手机号后再尝试解绑', 'uni-id-unbind-mobile-not-exists': '这是当前唯一登录方式,请绑定手机号后再尝试解绑',
'uni-id-unbind-password-not-exists': '请先设置密码在尝试解绑', 'uni-id-unbind-password-not-exists': '请先设置密码在尝试解绑',
'uni-id-unsupported-request': '不支持的请求方式', 'uni-id-unsupported-request': '不支持的请求方式',
'uni-id-illegal-request': '非法请求' 'uni-id-illegal-request': '非法请求',
'uni-id-config-field-required': '缺少配置项: {field}'
} }
module.exports = { module.exports = {
......
...@@ -20,6 +20,15 @@ module.exports = function () { ...@@ -20,6 +20,15 @@ module.exports = function () {
} }
} }
if (!this.config.requestAuthSecret || typeof this.config.requestAuthSecret !== 'string') {
throw {
errCode: ERROR.CONFIG_FIELD_REQUIRED,
errMsgVal: {
field: 'requestAuthSecret'
}
}
}
const timeout = 20 * 1000 // 请求超过20秒不能再请求,防止重放攻击 const timeout = 20 * 1000 // 请求超过20秒不能再请求,防止重放攻击
const { headers, body: _body } = this.getHttpInfo() const { headers, body: _body } = this.getHttpInfo()
const { 'uni-id-nonce': nonce, 'uni-id-timestamp': timestamp, 'uni-id-signature': signature } = headers const { 'uni-id-nonce': nonce, 'uni-id-timestamp': timestamp, 'uni-id-signature': signature } = headers
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册