1107
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
## 3.3.28(2022-07-27)
|
||||
- 修复 app端微信登录返回的accessToken过期时间(expired)不正确的Bug
|
||||
## 3.3.27(2022-07-27)
|
||||
- 短信发送失败、微信登录失败等场景下输出原始错误方便排查错误
|
||||
## 3.3.26(2022-07-08)
|
||||
- 兼容配置放在uni-id下的逻辑,但是仍推荐使用uni-config-center
|
||||
## 3.3.25(2022-06-30)
|
||||
- 修复config文件不合法时未抛出具体错误的Bug
|
||||
## 3.3.24(2022-06-28)
|
||||
- 修复3.3.12引出的使用多应用配置时报错的Bug
|
||||
## 3.3.23(2022-06-13)
|
||||
- 修复上版本引出的部分依赖未找到的Bug
|
||||
## 3.3.22(2022-06-13)
|
||||
- 新增 preferedWebPlatform 配置用于解决HBuilderX 3.4.9版本起web端platform不一致的问题 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=prefered-web-platform)
|
||||
## 3.3.21(2022-05-24)
|
||||
- 修复createInstance传入clientInfo无效的Bug
|
||||
## 3.3.20(2022-05-19)
|
||||
- 调整以下错误码(账号已注册[uni-id-account-exists]、账号不存在[uni-id-account-not-exists]、账号已绑定[uni-id-account-bound])
|
||||
## 3.3.19(2022-05-19)
|
||||
- 修复 addUser 部分情况下会创建出重复账号的Bug
|
||||
## 3.3.18(2022-05-12)
|
||||
- 调整绑定、解绑邮箱手机号接口,只要传递code参数就进行验证码校验即使传递的值为undefined
|
||||
## 3.3.17(2022-05-09)
|
||||
- register_env内增加os_name字段用于区分注册时的客户端系统类型
|
||||
## 3.3.16(2022-05-09)
|
||||
- 修复 addUser接口添加的用户无法使用密码登录的Bug [详情](https://ask.dcloud.net.cn/question/144670)
|
||||
## 3.3.15(2022-05-08)
|
||||
- 修复config文件语法错误时报`this.t is not a function`的Bug 感谢@寒暄
|
||||
## 3.3.14(2022-05-08)
|
||||
- 新增 getWeixinUserInfo接口 用于获取app平台微信登录用户的用户信息 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id.html#get-weixin-user-info)
|
||||
- 新增 addUser接口 用于手动添加用户 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id.html#add-user)
|
||||
- 新增 resetPwdBySms接口 用于使用短信验证码重置密码 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id.html#reset-pwd-by-sms)
|
||||
- 新增 refreshToken接口 用于主动刷新用户token [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id.html#refresh-token)
|
||||
- 调整 用户注册时记录用户注册环境到 register_env 字段 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id.html#user-table)
|
||||
- 调整 用户注册时将注册 ip 移至 register_env 内
|
||||
|
||||
## 3.3.13(2022-03-04)
|
||||
- createInstance方法支持传递clientInfo [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id.html#create-instance)
|
||||
- 修复`this.t is not a function`报错
|
||||
## 3.3.12(2022-01-15)
|
||||
- 新增 preferedAppPlatform 配置用于解决uni-app vue2版本vue3版本获取platform不一致的问题 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=prefered-app-platform)
|
||||
- 修复 checkToken 未返回自定义token内容的Bug
|
||||
## 3.3.11(2022-01-11)
|
||||
- 修复用户名密码登录时多个应用出现重复用户名登录报错的Bug
|
||||
## 3.3.10(2022-01-07)
|
||||
- 新增 自定义国际化语言支持 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=custom-i8n)
|
||||
- 修复 一键登录时未校验重复手机号是否已验证的Bug
|
||||
- 修复 Apple登录时用户邮箱为空时报错的Bug
|
||||
- 修复 登录接口未传username时错误提示不正确的Bug
|
||||
## 3.3.9(2021-11-09)
|
||||
- 去除重复的context.xxx未找到的提示语
|
||||
## 3.3.8(2021-10-28)
|
||||
- 新增 用户账户封禁接口 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=ban-account)
|
||||
- 新增 用户账户注销接口 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=close-account)
|
||||
- 修复 未传appid时用户重复注册的Bug
|
||||
## 3.3.7(2021-10-08)
|
||||
- 移除部分接口的废弃提示
|
||||
## 3.3.6(2021-09-08)
|
||||
- 修复 邀请码可能重复的Bug
|
||||
## 3.3.5(2021-08-10)
|
||||
- 修复版本号错误
|
||||
## 3.3.4(2021-08-10)
|
||||
- 微信、QQ、支付宝登录新增type参数用于指定当前是登录还是注册
|
||||
## 3.3.3(2021-08-04)
|
||||
- 修复使用数组形式的配置文件报错的Bug
|
||||
## 3.3.2(2021-08-03)
|
||||
- 修复上3.3.0版本引出的createInstance接口传入配置不生效的Bug 感谢[hmh](https://gitee.com/hmh)
|
||||
## 3.3.1(2021-07-30)
|
||||
- 修复 将设置用户允许登录的应用列表时传入空数组报错的Bug
|
||||
## 3.3.0(2021-07-30)
|
||||
- 新增 不同端应用配置隔离 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=isolate-config)
|
||||
- 新增 不同端用户隔离 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=isolate-user)
|
||||
+ 此版本升级需要开发者处理一下用户数据,请参考 [补齐用户dcloud_appid字段](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=makeup-dcloud-appid)
|
||||
- 新增 QQ登录、注册相关功能 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=qq)
|
||||
- 调整 不再支持绑定手机、邮箱时不填验证码直接绑定
|
||||
## 3.2.1(2021-07-09)
|
||||
- 撤销3.2.0版本所做的调整
|
||||
## 3.2.0(2021-07-09)
|
||||
- 【重要】支持不同端(管理端、用户端等)用户隔离 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=isolate-user)
|
||||
- 支持不同端(管理端、用户端等)配置文件隔离 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=isolate-config)
|
||||
## 3.1.3(2021-07-08)
|
||||
- 移除插件内误传的node_modules
|
||||
## 3.1.2(2021-07-08)
|
||||
- 修复 微信小程序绑定微信账号时报错的Bug
|
||||
## 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)
|
||||
- 修复 customToken导出async方法报错的Bug
|
||||
## 3.0.12(2021-04-13)
|
||||
- 调整bindTokenToDevice默认值为false
|
||||
## 3.0.11(2021-04-12)
|
||||
- 修复3.0.7版本引出的多个用户访问时可能出现30201报错的Bug
|
||||
## 3.0.10(2021-04-08)
|
||||
- 优化错误提示
|
||||
## 3.0.9(2021-04-08)
|
||||
- bindMobile接口支持通过一键登录的方式绑定
|
||||
- 优化错误提示
|
||||
## 3.0.8(2021-03-19)
|
||||
- 修复 3.0.7版本某些情况下生成token报错的Bug
|
||||
## 3.0.7(2021-03-19)
|
||||
- 新增 支持uni-config-center,更新uni-id无须再担心配置被覆盖 [详情](https://uniapp.dcloud.io/uniCloud/uni-id?id=uni-config-center)
|
||||
- 新增 自定义token内容,可以缓存角色权限之外的更多信息到客户端 [详情](https://uniapp.dcloud.io/uniCloud/uni-id?id=custom-token)
|
||||
- 新增 支持传入context获取uni-id实例,防止单实例多并发时全局context混乱 [详情](https://uniapp.dcloud.io/uniCloud/uni-id?id=create-instance)
|
||||
## 3.0.6(2021-03-05)
|
||||
- 新增[uniID.wxBizDataCrypt](https://uniapp.dcloud.io/uniCloud/uni-id?id=%e5%be%ae%e4%bf%a1%e6%95%b0%e6%8d%ae%e8%a7%a3%e5%af%86)方法
|
||||
- 优化loginByApple方法,提高接口响应速度
|
||||
## 3.0.5(2021-02-03)
|
||||
- 调整为uni_modules目录规范
|
||||
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"id": "uni-id",
|
||||
"displayName": "uni-id",
|
||||
"version": "3.3.29",
|
||||
"description": "简单、统一、可扩展的用户中心",
|
||||
"keywords": [
|
||||
"uniid",
|
||||
"uni-id",
|
||||
"用户管理",
|
||||
"用户中心",
|
||||
"短信验证码"
|
||||
],
|
||||
"repository": "https://gitee.com/dcloud/uni-id.git",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
},
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "",
|
||||
"type": "unicloud-template-function"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": ["uni-config-center"],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "u",
|
||||
"app-nvue": "u"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "u",
|
||||
"Android Browser": "u",
|
||||
"微信浏览器(Android)": "u",
|
||||
"QQ浏览器(Android)": "u"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "u",
|
||||
"IE": "u",
|
||||
"Edge": "u",
|
||||
"Firefox": "u",
|
||||
"Safari": "u"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "u",
|
||||
"阿里": "u",
|
||||
"百度": "u",
|
||||
"字节跳动": "u",
|
||||
"QQ": "u",
|
||||
"钉钉": "u",
|
||||
"快手": "u",
|
||||
"飞书": "u",
|
||||
"京东": "u"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
**文档已移至[uni-id文档](https://uniapp.dcloud.net.cn/uniCloud/uni-id)**
|
||||
|
||||
> 一般uni-id升级大版本时为不兼容更新,从低版本迁移到高版本请参考:[uni-id迁移指南](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=migration)
|
||||
|
||||
## 重要升级说明
|
||||
|
||||
**uni-id 3.x版本,搭配的uniCloud admin版本需大于1.2.10。**
|
||||
|
||||
### 缓存角色权限
|
||||
|
||||
自`uni-id 3.0.0`起,支持在token内缓存用户的角色权限,默认开启此功能,各登录接口的needPermission参数不再生效。如需关闭请在config内配置`"removePermissionAndRoleFromToken": true`。
|
||||
|
||||
为什么要缓存角色权限?要知道云数据库是按照读写次数来收取费用的,并且读写数据库会拖慢接口响应速度。未配置`"removePermissionAndRoleFromToken": true`的情况下,可以在调用checkToken接口时不查询数据库获取用户角色权限。
|
||||
|
||||
详细checkToken流程如下:
|
||||
|
||||

|
||||
|
||||
可以看出,旧版token(removePermissionAndRoleFromToken为true时生成的)在checkToken时如需返回权限需要进行两次数据库查询。新版token不需要查库即可返回权限信息。
|
||||
|
||||
**注意**
|
||||
|
||||
- 由于角色权限缓存在token内,可能会存在权限已经更新但是用户token未过期之前依然是旧版角色权限的情况。可以调短一些token过期时间来减少这种情况的影响。
|
||||
- admin角色token内不包含permission,如需自行判断用户是否有某个权限,要注意admin角色需要额外判断一下,写法如下
|
||||
```js
|
||||
const {
|
||||
role,
|
||||
permission
|
||||
} = await uniID.checkToken(event.uniIdToken)
|
||||
if(role.includes('admin') || permission.includes('your permission id')) {
|
||||
// 当前角色拥有'your permission id'对应的权限
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/node_modules/uni-config-center/package.json
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "uni-config-center",
|
||||
"version": "0.0.3",
|
||||
"description": "配置中心",
|
||||
"main": "index.js",
|
||||
"keywords": [],
|
||||
"author": "DCloud",
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
Generated
Vendored
+70
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"passwordSecret": "passwordSecret-demo",
|
||||
"tokenSecret": "tokenSecret-demo",
|
||||
"tokenExpiresIn": 604800,
|
||||
"tokenExpiresThreshold": 259200,
|
||||
"tokenMaxLimit": 10,
|
||||
"passwordErrorLimit": 6,
|
||||
"bindTokenToDevice": false,
|
||||
"passwordErrorRetryTime": 3600,
|
||||
"autoSetInviteCode": true,
|
||||
"forceInviteCode": false,
|
||||
"preferedAppPlatform": "app-plus",
|
||||
"preferedWebPlatform": "h5",
|
||||
"removeDcloudAppid": false,
|
||||
"app-plus": {
|
||||
"tokenExpiresIn": 604800,
|
||||
"oauth": {
|
||||
"weixin": {
|
||||
"appid": "",
|
||||
"appsecret": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"mp-weixin": {
|
||||
"oauth": {
|
||||
"weixin": {
|
||||
"appid": "",
|
||||
"appsecret": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"h5-weixin": {
|
||||
"oauth": {
|
||||
"weixin": {
|
||||
"appid": "",
|
||||
"appsecret": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"mp-alipay": {
|
||||
"oauth": {
|
||||
"alipay": {
|
||||
"appid": "",
|
||||
"privateKey": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"mp-qq": {
|
||||
"oauth": {
|
||||
"qq": {
|
||||
"appid": "",
|
||||
"appsecret": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"service": {
|
||||
"sms": {
|
||||
"name": "重要",
|
||||
"codeExpiresIn": 180,
|
||||
"smsKey": "",
|
||||
"smsSecret": "",
|
||||
"templateId": ""
|
||||
},
|
||||
"univerify": {
|
||||
"appid": "",
|
||||
"apiKey": "",
|
||||
"apiSecret": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
证书内容
|
||||
-----END CERTIFICATE-----
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
证书内容
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
证书内容
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
证书内容
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
证书内容
|
||||
-----END CERTIFICATE-----
|
||||
Generated
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
证书内容
|
||||
-----END CERTIFICATE-----
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
### 文件名:
|
||||
#### 1、`alipayCertPublicKey_RSA2.crt`
|
||||
#### 2、`alipayRootCert.crt`
|
||||
#### 3、`appCertPublicKey.crt`
|
||||

|
||||
Generated
Vendored
+128
@@ -0,0 +1,128 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
module.exports = {
|
||||
/**
|
||||
* 统一支付回调地址,格式为 "服务空间SpaceID":"URL化完整地址"
|
||||
* 这里的本地开发并不是指 http://localhost:8080/ 的地址,而是另外一个服务空间的ULR化地址(如果你本地开发和线上环境共用同一个服务空间则只需要填线上环境的即可)
|
||||
* 回调的云函数地址,建议填 /http/vk-pay,因为vk-pay云函数已经写好了回调处理的逻辑,否则你需要自己写全部的回调逻辑。
|
||||
* 其中vk-pay是可以改名的,只需要修改 uniCloud/cloudfunctions/vk-pay/package.json 文件中的 "path": "/http/vk-pay", 把 /http/vk-pay 改成 /http/xxxx 即可(需要重新上传云函数vk-pay)。
|
||||
*/
|
||||
"notifyUrl": {
|
||||
// 本地开发环境,如果你本地开发和线上环境共用同一个服务空间则只需要填线上环境的即可
|
||||
"mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5": "https://mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5.bspapp.com/http/vk-pay",
|
||||
// 线上正式环境
|
||||
"mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5": "https://fc-mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5.next.bspapp.com/http/vk-pay"
|
||||
},
|
||||
/**
|
||||
* 微信
|
||||
* 公共参数说明
|
||||
* appId 微信后台的appId
|
||||
* secret 微信后台的secret
|
||||
* mchId 微信支付的商户id
|
||||
* key 微信支付的api密钥(V2版本)
|
||||
* pfx 微信支付的p12证书(退款需要)
|
||||
*/
|
||||
"wxpay": {
|
||||
// 微信 - 小程序支付(微信支付申请JSAPI支付)
|
||||
"mp-weixin": {
|
||||
"appId": "",
|
||||
"secret": "",
|
||||
"mchId": "",
|
||||
"key": "",
|
||||
"pfx": fs.readFileSync(__dirname + '/wxpay/wxpay.p12')
|
||||
},
|
||||
// 微信 - APP支付(微信支付申请APP支付)
|
||||
"app-plus": {
|
||||
"appId": "",
|
||||
"secret": "",
|
||||
"mchId": "",
|
||||
"key": "",
|
||||
"pfx": fs.readFileSync(__dirname + '/wxpay/wxpay.p12')
|
||||
},
|
||||
// 微信 - H5电脑网站二维码支付(微信支付申请Native支付)
|
||||
"h5": {
|
||||
"appId": "",
|
||||
"secret": "",
|
||||
"mchId": "",
|
||||
"key": "",
|
||||
"pfx": fs.readFileSync(__dirname + '/wxpay/wxpay.p12')
|
||||
},
|
||||
// 微信 - 公众号支付(微信支付申请JSAPI支付)
|
||||
"h5-weixin": {
|
||||
"appId": "",
|
||||
"secret": "",
|
||||
"mchId": "",
|
||||
"key": "",
|
||||
"pfx": fs.readFileSync(__dirname + '/wxpay/wxpay.p12')
|
||||
},
|
||||
// 微信 - 手机外部浏览器H5支付(微信支付申请H5支付)
|
||||
"mweb": {
|
||||
"appId": "",
|
||||
"secret": "",
|
||||
"mchId": "",
|
||||
"key": "",
|
||||
"pfx": fs.readFileSync(__dirname + '/wxpay/wxpay.p12'),
|
||||
// 场景信息,必填
|
||||
"sceneInfo": {
|
||||
"h5_info": {
|
||||
"type": "Wap", // 此值固定Wap
|
||||
"wap_url": "https://www.xxxxxx.com", // 你的H5首页地址,必须和你发起支付的页面的域名一致。
|
||||
"wap_name": "网站名称", // 你的H5网站名称
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 支付宝(证书记得选java版本)
|
||||
* 公共参数说明
|
||||
* mchId 支付宝商户id 2088开头的那个(此参数可以去除)
|
||||
* appId 支付宝开放平台的应用appId
|
||||
* secret 支付宝开放平台的应用secret
|
||||
* privateKey 应用私钥
|
||||
* alipayPublicCertPath 支付宝公钥证书路径地址 与之对应的 alipayPublicCertContent 为支付宝公钥证书内容(值可以是字符串也可以是Buffer)
|
||||
* alipayRootCertPath 支付宝根证书路径地址 与之对应的 alipayRootCertContent 为支付宝根证书内容(值可以是字符串也可以是Buffer)
|
||||
* appCertPath 应用证书路径地址 与之对应的 appCertPathContent 为应用证书内容(值可以是字符串也可以是Buffer)
|
||||
* sandbox 是否沙箱模式 true 沙箱模式 false 正常模式
|
||||
*/
|
||||
"alipay": {
|
||||
// 支付宝 - 小程序支付配置
|
||||
"mp-alipay": {
|
||||
"mchId": "",
|
||||
"appId": "",
|
||||
"privateKey": "",
|
||||
"alipayPublicCertPath": path.join(__dirname, 'alipay/alipayCertPublicKey_RSA2.crt'),
|
||||
"alipayRootCertPath": path.join(__dirname, 'alipay/alipayRootCert.crt'),
|
||||
"appCertPath": path.join(__dirname, 'alipay/appCertPublicKey.crt'),
|
||||
"sandbox": false
|
||||
},
|
||||
// 支付宝 - APP支付配置
|
||||
"app-plus": {
|
||||
"mchId": "",
|
||||
"appId": "",
|
||||
"privateKey": "",
|
||||
"alipayPublicCertPath": path.join(__dirname, 'alipay/alipayCertPublicKey_RSA2.crt'),
|
||||
"alipayRootCertPath": path.join(__dirname, 'alipay/alipayRootCert.crt'),
|
||||
"appCertPath": path.join(__dirname, 'alipay/appCertPublicKey.crt'),
|
||||
"sandbox": false
|
||||
},
|
||||
// 支付宝 - H5支付配置(包含:网站二维码、手机H5,需申请支付宝当面付接口权限)
|
||||
"h5": {
|
||||
"mchId": "",
|
||||
"appId": "",
|
||||
"privateKey": "",
|
||||
"alipayPublicCertPath": path.join(__dirname, 'alipay/alipayCertPublicKey_RSA2.crt'),
|
||||
"alipayRootCertPath": path.join(__dirname, 'alipay/alipayRootCert.crt'),
|
||||
"appCertPath": path.join(__dirname, 'alipay/appCertPublicKey.crt'),
|
||||
"sandbox": false
|
||||
},
|
||||
// 支付宝 - 转账到支付宝等资金转出接口,其中 appCertSn 和 alipayRootCertSn 通过工具获取
|
||||
"transfer": {
|
||||
"mchId": "",
|
||||
"appId": "",
|
||||
"privateKey": "",
|
||||
"appCertSn": "", // 应用证书的序列号
|
||||
"alipayRootCertSn": "", // 支付宝根证书的序列号
|
||||
"sandbox": false
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
Vendored
Generated
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
### 文件名:
|
||||
#### 1、`wxpay.p12`
|
||||

|
||||
Generated
Vendored
+141
@@ -0,0 +1,141 @@
|
||||
var uniIdConfig;
|
||||
var uniPayConfig;
|
||||
try {
|
||||
uniIdConfig = require('../uni-id/config.json');
|
||||
} catch(err) {
|
||||
console.error("配置文件:uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json 编译错误,请检查!↓↓↓请查看下方的错误提示↓↓↓", err.name, err.message, err);
|
||||
throw new Error("配置文件:uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json 编译错误,请检查!↑↑↑请查看上方的错误提示↑↑↑");
|
||||
}
|
||||
|
||||
try {
|
||||
uniPayConfig = require('../uni-pay/config.js');
|
||||
} catch(err) {
|
||||
console.error("配置文件:uniCloud/cloudfunctions/common/uni-config-center/uni-pay/config.js 编译错误,请检查!↓↓↓请查看下方的错误提示↓↓↓", err.name, err.message, err);
|
||||
throw new Error("配置文件:uniCloud/cloudfunctions/common/uni-config-center/uni-pay/config.js 编译错误,请检查!↑↑↑请查看上方的错误提示↑↑↑");
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
"uni": uniIdConfig,
|
||||
"uni-pay": uniPayConfig,
|
||||
"vk": {
|
||||
"system": {
|
||||
// 若serviceShutdow:true,则所有云函数无法访问(适用于需要临时关闭后端服务的情况,如迁移数据)
|
||||
// 注意:本地调试时,需要重新启动本地服务才能生效。
|
||||
"serviceShutdown": false,
|
||||
"serviceShutdownDescription": "系统维护中,预计2小时恢复!",
|
||||
// 云函数默认时区(中国为8)
|
||||
"targetTimezone": 8
|
||||
},
|
||||
// 加密的密钥
|
||||
"crypto": {
|
||||
"aes": "dad4c0cb88c7d005bc5e844b8e79a9f0dad4c0cb88c7d005bc5e844b8e79a9f0", // 对称加密的密钥,建议长度在64位-128位(此处建议修改成自己的密钥)
|
||||
},
|
||||
// 当 context 内的下面值为空时,赋予默认的值(主要用于解决云函数 URL 后的默认 APPID 问题。
|
||||
"context": {
|
||||
"APPID": "", // 默认 dcloud_appid
|
||||
"PLATFORM": "h5", // 可选项 h5、mp-weixin、app-plus、mp-alipay
|
||||
"LOCALE": "zh-Hans", // 默认语言
|
||||
"CLIENTIP":"127.0.0.1", // 默认客户端IP(主要用于解决本地调试无ip的问题)
|
||||
},
|
||||
"service": {
|
||||
// 邮箱发送服务
|
||||
"email": {
|
||||
"codeExpiresIn": 180, // 邮件验证码有效期(单位秒)
|
||||
// qq邮箱参数配置
|
||||
"qq": {
|
||||
"host": "smtp.qq.com",
|
||||
"port": 465,
|
||||
"secure": true,
|
||||
"auth": {
|
||||
"user": "你的邮箱@qq.com",
|
||||
"pass": "邮箱授权码"
|
||||
}
|
||||
},
|
||||
// 163邮箱配置
|
||||
"163":{
|
||||
"host": "smtp.163.com",
|
||||
"port": 465,
|
||||
"secure": true,
|
||||
"auth": {
|
||||
"user": "",
|
||||
"pass": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
// 日志服务
|
||||
"log": {
|
||||
// 用户登录日志
|
||||
"login": {
|
||||
"status": true // 是否开启用户登录日志
|
||||
}
|
||||
},
|
||||
// 短信服务
|
||||
"sms": {
|
||||
// 阿里云短信服务
|
||||
"aliyun": {
|
||||
"enable": true, // 是否使用阿里云短信代替unicloud短信发送短信验证码
|
||||
"accessKeyId": "LTAI4FyY6A493kVYn5ezyAw6", // 短信密钥key
|
||||
"accessKeySecret": "776MyYZfRb8cQHTe5ji0jBVu1rHfa9", // 短信密钥secret
|
||||
"signName": "亿利通", // 默认签名
|
||||
"templateCode": {
|
||||
"verifyCode": "SMS_210078693" // 验证码短信模板 - 配合uni-id需要
|
||||
}
|
||||
}
|
||||
},
|
||||
// 开放平台api
|
||||
"openapi": {
|
||||
// 百度开放平台 (主要用于身份证识别,营业执照识别等API)
|
||||
// API Key申请地址:https://cloud.baidu.com/doc/OCR/s/rk3h7xzck 点击右上角注册
|
||||
"baidu": {
|
||||
"appid": "", // 对应的API Key
|
||||
"appsecret": "" // 对应的Secret Key
|
||||
}
|
||||
}
|
||||
},
|
||||
"db": {
|
||||
"unicloud": {
|
||||
"maxLimit": 1000, // 最大limit限制(目前腾讯云最大1000,阿里云最大1000)
|
||||
"cancelAddTime": false, // 取消 vk.baseDao.add 时自动生成 _add_time 和 _add_time_str
|
||||
"cancelAddTimeStr": false, // 仅取消 vk.baseDao.add 时自动生成的 _add_time_str,若已设置 cancelAddTime 为true,则 cancelAddTimeStr 也会强制为true
|
||||
"getTableData": {
|
||||
"sortArr": [{ "name": "_add_time", "type": "desc" }], // vk.baseDao.getTableData 默认排序规则 vk.db.unicloud.getTableData.sortArr
|
||||
}
|
||||
}
|
||||
},
|
||||
// 其他小程序的密钥 当需要多个小程序绑定同一服务空间,并调用小程序服务端API时需要填写 暂只支持微信小程序
|
||||
"oauth": {
|
||||
// 微信小程序
|
||||
"weixin": {
|
||||
// 密钥列表
|
||||
"list": [
|
||||
{ "appid": "", "appsecret": "" },
|
||||
{ "appid": "", "appsecret": "" }
|
||||
]
|
||||
},
|
||||
// 支付宝
|
||||
"alipay": {
|
||||
// 密钥列表
|
||||
"list": [
|
||||
{ "appid": "", "privateKey": "" },
|
||||
{ "appid": "", "privateKey": "" }
|
||||
]
|
||||
},
|
||||
// qq
|
||||
"qq": {
|
||||
// 密钥列表
|
||||
"list": [
|
||||
{ "appid": "", "appsecret": "" },
|
||||
{ "appid": "", "appsecret": "" }
|
||||
]
|
||||
},
|
||||
// 抖音
|
||||
"toutiao": {
|
||||
// 密钥列表
|
||||
"list": [
|
||||
{ "appid": "", "appsecret": "" },
|
||||
{ "appid": "", "appsecret": "" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/node_modules/uni-config-center/【重要】请先看这里.md
Generated
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
## 重要说明
|
||||
|
||||
#### 框架目前的配置(不含`uni-id`)在 `cloudfunctions/common/uni-config-center/vk-unicloud/index.js` 中配置
|
||||
|
||||
#### `uni-id` 的配置是在 `cloudfunctions/common/uni-config-center/uni-id/config.json` 中配置
|
||||
|
||||
#### 每次修改完 配置 中的内容后如果不生效,则尝试以下操作。
|
||||
```
|
||||
1. 上传 uni-config-center 公共模块
|
||||
2. 重新上传 router 云函数
|
||||
|
||||
如果是连接本地云函数,则需要重启本地服务才会生效。(hbx的原因)
|
||||
```
|
||||
|
||||
|
||||
### 由于`uni-id`配置无法打注释,故下方为`uni-id`配置的介绍
|
||||
```js
|
||||
{
|
||||
"passwordSecret": "passwordSecret-demo",// 加密密码所用的密钥,修改会导致所用户之前的密码失效。如一定要修改,请查看https://uniapp.dcloud.io/uniCloud/uni-id?id=modifysecret
|
||||
"tokenSecret": "tokenSecret-demo", // 生成token所用的密钥,修改会导致所有用户之前的token失效。
|
||||
"tokenExpiresIn": 604800, // 全平台token过期时间,未指定过期时间的平台会使用此值,604800代表7天
|
||||
"tokenExpiresThreshold": 3600, // 新增于uni-id 1.1.7版本,checkToken时如果token有效期小于此值则自动获取新token,如果不配置此参数则不开启自动获取新token功能
|
||||
"passwordErrorLimit": 6, // 密码错误最大重试次数
|
||||
"bindTokenToDevice": false, // 是否将token和设备绑定,设置为true会进行ua校验
|
||||
"passwordErrorRetryTime": 3600, // 密码错误重试次数超限之后的冻结时间
|
||||
"autoSetInviteCode": true, // 是否在用户注册时自动设置邀请码
|
||||
"forceInviteCode": false, // 是否强制用户注册时必填邀请码,默认为false(需要注意的是目前只有短信验证码注册才可以填写邀请码)
|
||||
"app-plus": {
|
||||
"tokenExpiresIn": 604800, // app端 token过期时间
|
||||
"oauth" : {
|
||||
// App微信登录所用到的appid、appsecret需要在微信开放平台获取,注意:不是公众平台而是开放平台
|
||||
"weixin" : {
|
||||
"appid" : "",
|
||||
"appsecret" : ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"mp-weixin": {
|
||||
"oauth" : {
|
||||
// 微信小程序登录所用的appid、appsecret需要在对应的小程序管理控制台获取
|
||||
"weixin" : {
|
||||
"appid" : "",
|
||||
"appsecret" : ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"mp-alipay": {
|
||||
"oauth" : {
|
||||
// 支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr
|
||||
"alipay" : {
|
||||
"appid" : "",
|
||||
"privateKey" : ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"service": {
|
||||
// unicloud短信
|
||||
"sms": {
|
||||
"name": "重要", // 应用名称,对应短信模版的name
|
||||
"codeExpiresIn": 180, // 验证码过期时间,单位为秒,注意一定要是60的整数倍
|
||||
"smsKey": "你的smsKey", // 短信密钥key,开通短信服务处可以看到 https://dev.dcloud.net.cn/uniSms
|
||||
"smsSecret": "你的smsSecret", // 短信密钥secret,开通短信服务处可以看到 https://dev.dcloud.net.cn/uniSms
|
||||
"templateId":"你的短信模板ID" // 短信模板ID
|
||||
},
|
||||
// 一键登录
|
||||
"univerify": {
|
||||
"appid":"your appid", // uniapp的appid
|
||||
"apiKey": "your apiKey", // 一键登录的apiKey
|
||||
"apiSecret": "your apiSecret" // 一键登录的apiSecret
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "uni-id",
|
||||
"version": "3.3.28",
|
||||
"description": "uni-id for uniCloud",
|
||||
"main": "index.js",
|
||||
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitee.com/dcloud/uni-id.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user