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

优化项目文档

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