提交 72127b2d 编写于 作者: DCloud_JSON's avatar DCloud_JSON

优化项目文档

上级 fd4e1059
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
> 用途:主要使用在登录、需要人机校验或其他限制调用的场景 > 用途:主要使用在登录、需要人机校验或其他限制调用的场景
> 验证码生成、校验都在服务端。页面使用返回的 base64 显示。[云端一体登模板](https://ext.dcloud.net.cn/plugin?id=13)已集成,可下载体验。 > 验证码生成、校验都在服务端。页面使用返回的 base64 显示。[云端一体登模板](https://ext.dcloud.net.cn/plugin?id=13)已集成,可下载体验。
> 数据表使用[opendb-verify-codes](https://gitee.com/dcloud/opendb/blob/master/collection/opendb-verify-codes/collection.json) > 数据表使用[opendb-verify-codes](https://gitee.com/dcloud/opendb/blob/master/collection/opendb-verify-codes/collection.json)
......
## 1.0.3(2021-07-02)
- 框架设定非 admin 不能创建用户, 用户可自定义
## 1.0.2(2021-07-01) ## 1.0.2(2021-07-01)
1. 发送短信验证码api,默认注释掉:虚拟发送短信验证码的代码块。 1. 发送短信验证码api,默认注释掉:虚拟发送短信验证码的代码块。
2. 统一action名称为驼峰法 2. 统一action名称为驼峰法
......
{ {
"id": "uni-id-cf", "id": "uni-id-cf",
"displayName": "uni-id-cf", "displayName": "uni-id-cf",
"version": "1.0.2", "version": "1.0.3",
"description": "uni-id-cf", "description": "uni-id-cf",
"keywords": [ "keywords": [
"uni-id-cf", "uni-id-cf",
......
...@@ -61,7 +61,7 @@ exports.main = async (event, context) => { ...@@ -61,7 +61,7 @@ exports.main = async (event, context) => {
} }
params.uid = payload.uid params.uid = payload.uid
} }
//禁止前台用户传递角色 //禁止前台用户传递角色
if (action.slice(0,7) == "loginBy") { if (action.slice(0,7) == "loginBy") {
if (params.role) { if (params.role) {
...@@ -254,7 +254,7 @@ exports.main = async (event, context) => { ...@@ -254,7 +254,7 @@ exports.main = async (event, context) => {
// type: params.type // type: params.type
// }) // })
/* -结束- */ /* -结束- */
// 简单限制一下客户端调用频率 // 简单限制一下客户端调用频率
const ipLimit = await db.collection('opendb-verify-codes').where({ const ipLimit = await db.collection('opendb-verify-codes').where({
ip: context.CLIENTIP, ip: context.CLIENTIP,
...@@ -385,7 +385,7 @@ exports.main = async (event, context) => { ...@@ -385,7 +385,7 @@ exports.main = async (event, context) => {
} = await uniID.getUserInfo({ } = await uniID.getUserInfo({
uid: params.uid uid: params.uid
}) })
if (userInfo.role.indexOf('admin') === -1 && params.role.indexOf('admin') > -1) { if (userInfo.role.indexOf('admin') === -1) {
res = { res = {
code: 403, code: 403,
message: '非法访问, 无权限注册超级管理员', message: '非法访问, 无权限注册超级管理员',
...@@ -415,4 +415,4 @@ exports.main = async (event, context) => { ...@@ -415,4 +415,4 @@ exports.main = async (event, context) => {
} }
//返回数据给客户端 //返回数据给客户端
return res return res
} }
\ No newline at end of file
{ {
"name": "uni-id-cf", "name": "uni-id-cf",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 2, "lockfileVersion": 1,
"requires": true, "requires": true,
"packages": {
"": {
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"uni-captcha": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"uni-id": "file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id"
}
},
"../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha": {
"version": "0.1.0",
"license": "Apache-2.0"
},
"../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center": {
"version": "0.0.2",
"license": "Apache-2.0"
},
"../../../../uni-id/uniCloud/cloudfunctions/common/uni-id": {
"version": "3.1.0",
"license": "Apache-2.0",
"dependencies": {
"uni-captcha": "file:../../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
},
"node_modules/uni-captcha": {
"resolved": "../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"link": true
},
"node_modules/uni-config-center": {
"resolved": "../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"link": true
},
"node_modules/uni-id": {
"resolved": "../../../../uni-id/uniCloud/cloudfunctions/common/uni-id",
"link": true
}
},
"dependencies": { "dependencies": {
"uni-captcha": { "uni-captcha": {
"version": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha" "version": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
...@@ -52,8 +13,16 @@ ...@@ -52,8 +13,16 @@
"uni-id": { "uni-id": {
"version": "file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id", "version": "file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id",
"requires": { "requires": {
"uni-captcha": "file:../../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha", "uni-captcha": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" "uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
},
"dependencies": {
"uni-captcha": {
"version": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
},
"uni-config-center": {
"version": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
} }
} }
} }
......
## 3.1.1(2021-07-01)
- 使用新的错误码规范,兼容旧版 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=errcode)
- 修复微信登录、绑定时未返回用户accessToken的Bug
## 3.1.0(2021-04-19) ## 3.1.0(2021-04-19)
- 增加对用户名、邮箱、密码字段的两端去空格 - 增加对用户名、邮箱、密码字段的两端去空格
- 默认忽略用户名、邮箱的大小写 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=case-sensitive) - 默认忽略用户名、邮箱的大小写 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=case-sensitive)
......
{ {
"id": "uni-id", "id": "uni-id",
"displayName": "uni-id公共模块", "displayName": "uni-id",
"version": "3.1.0", "version": "3.1.1",
"description": "简单、统一、可扩展的用户中心", "description": "简单、统一、可扩展的用户中心",
"keywords": [ "keywords": [
"uniid", "uniid",
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": 0 "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": 0 "price": "0.00"
} }
}, },
"contact": { "contact": {
......
{ {
"name": "uni-id", "name": "uni-id",
"version": "3.1.0", "version": "3.1.0",
"lockfileVersion": 2, "lockfileVersion": 1,
"requires": true, "requires": true,
"packages": {
"": {
"version": "3.1.0",
"license": "Apache-2.0",
"dependencies": {
"uni-captcha": "file:../../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
},
"../../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha": {
"version": "0.1.0",
"license": "Apache-2.0"
},
"../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center": {
"version": "0.0.2",
"license": "Apache-2.0"
},
"node_modules/uni-captcha": {
"resolved": "../../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"link": true
},
"node_modules/uni-config-center": {
"resolved": "../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"link": true
}
},
"dependencies": { "dependencies": {
"uni-captcha": { "uni-captcha": {
"version": "file:../../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha" "version": "file:../../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
......
{ {
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "文章详情", "navigationBarTitleText": "文章详情",
"app-plus": { "app-plus": {
"titleNView": { "titleNView": {
"type": "transparent", "type": "transparent",
"buttons": [{ "buttons": [{
"type": "share" "type": "share"
}] }]
} }
}, },
"h5": { "h5": {
"titleNView": { "titleNView": {
"type": "transparent", "type": "transparent",
"buttons": [] "buttons": []
} }
} }
} }
} }
] ]
} }
{ {
"passwordSecret": "passwordSecret-demo", "passwordSecret": "passwordSecret-demo",
"tokenSecret": "tokenSecret-demo", "tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200, "tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600, "tokenExpiresThreshold": 600,
"passwordErrorLimit": 6, "passwordErrorLimit": 6,
"bindTokenToDevice": false, "bindTokenToDevice": false,
"passwordErrorRetryTime": 3600, "passwordErrorRetryTime": 3600,
"autoSetInviteCode": false, "autoSetInviteCode": false,
"forceInviteCode": false, "forceInviteCode": false,
"app-plus": { "app-plus": {
"tokenExpiresIn": 2592000, "tokenExpiresIn": 2592000,
"oauth": { "oauth": {
"weixin": { "weixin": {
"appid": "wxffdd8fa6ec4ef2a0", "appid": "填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appid",
"appsecret": "6c9119430d7be0a147bcbbb73ef33acf" "appsecret": "填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appsecret"
}, },
"apple": { "apple": {
"bundleId": "io.dcloud.hellouniapp" "bundleId": "苹果开发者后台获取的bundleId"
} }
} }
}, },
"mp-weixin": { "mp-weixin": {
"oauth": { "oauth": {
"weixin": { "weixin": {
"appid": "wx81dbb061d2258234", "appid": "微信小程序登录所用的appid、appsecret需要在对应的小程序管理控制台获取",
"appsecret": "51977820eb14cd71377d4048a1b4754e" "appsecret": "微信小程序后台获取的appsecret"
} }
} }
}, },
"mp-alipay": { "mp-alipay": {
"oauth": { "oauth": {
"alipay": { "alipay": {
"appid": "alipay appid", "appid": "支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr",
"privateKey": "alipay privateKey" "privateKey": "支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr"
} }
} }
}, },
"service": { "service": {
"sms": { "sms": {
"name": "DCloud", "name": "应用名称,对应短信模版的name",
"codeExpiresIn": 300, "codeExpiresIn": 300,
"smsKey": "71a19f38c954f7d768d68a050486bf15", "smsKey": "短信密钥key,开通短信服务处可以看到",
"smsSecret": "d6c424b702d73baa3b6e1a1452469213" "smsSecret": "短信密钥secret,开通短信服务处可以看到"
}, },
"univerify": { "univerify": {
"appid": "__UNI__03B096E", "appid": "当前应用的appid,使用云函数URL化,此项必须配置",
"apiKey": "3fc28519d90d74173bcecf2daf4ffcc4", "apiKey": "apiKey 和 apiSecret 在开发者中心获取,开发者中心:https://dev.dcloud.net.cn/uniLogin/index?type=0,文档:https://ask.dcloud.net.cn/article/37965",
"apiSecret": "dd793e5bc4b372ce932f35bbb4c5d61b" "apiSecret": ""
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册