Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello_uni-id-pages
提交
b202e148
H
hello_uni-id-pages
项目概览
DCloud
/
hello_uni-id-pages
通知
1054
Star
31
Fork
43
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
2
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello_uni-id-pages
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b202e148
编写于
6月 23, 2022
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: update jsdoc
上级
c3365ae6
变更
36
隐藏空白更改
内联
并排
Showing
36 changed file
with
344 addition
and
53 deletion
+344
-53
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
...i-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
+257
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/account/close-account.js
.../cloudfunctions/uni-id-co/module/account/close-account.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/account/get-account-info.js
...oudfunctions/uni-id-co/module/account/get-account-info.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/account/reset-pwd-by-sms.js
...oudfunctions/uni-id-co/module/account/reset-pwd-by-sms.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/account/update-pwd.js
...oud/cloudfunctions/uni-id-co/module/account/update-pwd.js
+53
-52
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/admin/add-user.js
...niCloud/cloudfunctions/uni-id-co/module/admin/add-user.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/dev/get-supported-login-type.js
...unctions/uni-id-co/module/dev/get-supported-login-type.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/fission/accept-invite.js
.../cloudfunctions/uni-id-co/module/fission/accept-invite.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/fission/get-invited-user.js
...oudfunctions/uni-id-co/module/fission/get-invited-user.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-alipay.js
.../cloudfunctions/uni-id-co/module/login/login-by-alipay.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-apple.js
...d/cloudfunctions/uni-id-co/module/login/login-by-apple.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-qq.js
...loud/cloudfunctions/uni-id-co/module/login/login-by-qq.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-sms.js
...oud/cloudfunctions/uni-id-co/module/login/login-by-sms.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-univerify.js
...oudfunctions/uni-id-co/module/login/login-by-univerify.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-weixin.js
.../cloudfunctions/uni-id-co/module/login/login-by-weixin.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login.js
...s/uniCloud/cloudfunctions/uni-id-co/module/login/login.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/logout/logout.js
...uniCloud/cloudfunctions/uni-id-co/module/logout/logout.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/multi-end/authorize-app-login.js
...nctions/uni-id-co/module/multi-end/authorize-app-login.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/multi-end/remove-authorized-app.js
...tions/uni-id-co/module/multi-end/remove-authorized-app.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/multi-end/set-authorized-app.js
...unctions/uni-id-co/module/multi-end/set-authorized-app.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/register/register-admin.js
...loudfunctions/uni-id-co/module/register/register-admin.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/register/register-user.js
...cloudfunctions/uni-id-co/module/register/register-user.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-alipay.js
...oud/cloudfunctions/uni-id-co/module/relate/bind-alipay.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-apple.js
...loud/cloudfunctions/uni-id-co/module/relate/bind-apple.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-mobile-by-mp-weixin.js
...tions/uni-id-co/module/relate/bind-mobile-by-mp-weixin.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-mobile-by-sms.js
...udfunctions/uni-id-co/module/relate/bind-mobile-by-sms.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-mobile-by-univerify.js
...tions/uni-id-co/module/relate/bind-mobile-by-univerify.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-qq.js
...niCloud/cloudfunctions/uni-id-co/module/relate/bind-qq.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-weixin.js
...oud/cloudfunctions/uni-id-co/module/relate/bind-weixin.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/refresh-token.js
...ud/cloudfunctions/uni-id-co/module/utils/refresh-token.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/set-push-cid.js
...oud/cloudfunctions/uni-id-co/module/utils/set-push-cid.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/create-captcha.js
.../cloudfunctions/uni-id-co/module/verify/create-captcha.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/refresh-captcha.js
...cloudfunctions/uni-id-co/module/verify/refresh-captcha.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/send-email-code.js
...cloudfunctions/uni-id-co/module/verify/send-email-code.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/send-email-link.js
...cloudfunctions/uni-id-co/module/verify/send-email-link.js
+1
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/send-sms-code.js
...d/cloudfunctions/uni-id-co/module/verify/send-sms-code.js
+1
-0
未找到文件。
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
浏览文件 @
b202e148
...
@@ -139,7 +139,7 @@ module.exports = {
...
@@ -139,7 +139,7 @@ module.exports = {
},
},
/**
/**
* 注册管理员
* 注册管理员
* @tutorial https://
dcloud.io
* @tutorial https://
uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#register-admin
* @param {Object} params
* @param {Object} params
* @param {String} params.username 用户名
* @param {String} params.username 用户名
* @param {String} params.password 密码
* @param {String} params.password 密码
...
@@ -147,36 +147,292 @@ module.exports = {
...
@@ -147,36 +147,292 @@ module.exports = {
* @returns
* @returns
*/
*/
registerAdmin
,
registerAdmin
,
/**
* 新增用户
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#add-user
* @param {Object} params
* @param {String} params.username 用户名
* @param {String} params.password 密码
* @param {String} params.nickname 昵称
* @param {Array} params.authorizedApp 允许登录的AppID列表
* @param {Array} params.role 用户角色列表
* @returns
*/
addUser
,
addUser
,
/**
* 授权用户登录应用
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#authorize-app-login
* @param {Object} params
* @param {String} params.uid 用户id
* @param {String} params.appId 授权的应用的AppId
* @returns
*/
authorizeAppLogin
,
authorizeAppLogin
,
/**
* 移除用户登录授权
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#remove-authorized-app
* @param {Object} params
* @param {String} params.uid 用户id
* @param {String} params.appId 取消授权的应用的AppId
* @returns
*/
removeAuthorizedApp
,
removeAuthorizedApp
,
/**
* 设置用户允许登录的应用列表
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#set-authorized-app
* @param {Object} params
* @param {String} params.uid 用户id
* @param {Array} params.appIdList 允许登录的应用AppId列表
* @returns
*/
setAuthorizedApp
,
setAuthorizedApp
,
/**
* 注册普通用户
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#register-user
* @param {Object} params
* @param {String} params.username 用户名
* @param {String} params.password 密码
* @param {String} params.captcha 图形验证码
* @param {String} params.nickname 昵称
* @param {String} params.inviteCode 邀请码
* @returns
*/
registerUser
,
registerUser
,
/**
* 用户名密码登录
* @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
*/
login
,
login
,
/**
* 短信验证码登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-sms
* @param {Object} params
* @param {String} params.mobile 手机号
* @param {String} params.code 短信验证码
* @param {String} params.captcha 图形验证码
* @param {String} params.inviteCode 邀请码
* @returns
*/
loginBySms
,
loginBySms
,
/**
* App端一键登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-univerify
* @param {Object} params
* @param {String} params.access_token APP端一键登录返回的access_token
* @param {String} params.openid APP端一键登录返回的openid
* @param {String} params.inviteCode 邀请码
* @returns
*/
loginByUniverify
,
loginByUniverify
,
/**
* 微信登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-weixin
* @param {Object} params
* @param {String} params.code 微信登录返回的code
* @param {String} params.inviteCode 邀请码
* @returns
*/
loginByWeixin
,
loginByWeixin
,
/**
* 支付宝登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-alipay
* @param {Object} params
* @param {String} params.code 支付宝小程序客户端登录返回的code
* @param {String} params.inviteCode 邀请码
* @returns
*/
loginByAlipay
,
loginByAlipay
,
/**
* QQ登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-qq
* @param {Object} params
* @param {String} params.code QQ小程序登录返回的code参数
* @param {String} params.accessToken App端QQ登录返回的accessToken参数
* @param {String} params.accessTokenExpired 由App端QQ登录返回的expires_in参数计算而来
* @param {String} params.inviteCode 邀请码
* @returns
*/
loginByQQ
,
loginByQQ
,
/**
* 苹果登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-apple
* @param {Object} params
* @param {String} params.identityToken 苹果登录返回的identityToken
* @param {String} params.nickname 用户昵称
* @param {String} params.inviteCode 邀请码
* @returns
*/
loginByApple
,
loginByApple
,
/**
* 用户退出登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#logout
* @returns
*/
logout
,
logout
,
/**
* 通过短信验证码绑定手机号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-mobile-by-sms
* @param {Object} params
* @param {String} params.mobile 手机号
* @param {String} params.code 短信验证码
* @param {String} params.captcha 图形验证码
* @returns
*/
bindMobileBySms
,
bindMobileBySms
,
/**
* 通过一键登录绑定手机号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-mobile-by-univerify
* @param {Object} params
* @param {String} params.openid APP端一键登录返回的openid
* @param {String} params.access_token APP端一键登录返回的access_token
* @returns
*/
bindMobileByUniverify
,
bindMobileByUniverify
,
/**
* 通过微信绑定手机号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-mobile-by-mp-weixin
* @param {Object} params
* @param {String} params.encryptedData 微信获取手机号返回的加密信息
* @param {String} params.iv 微信获取手机号返回的初始向量
* @returns
*/
bindMobileByMpWeixin
,
bindMobileByMpWeixin
,
/**
* 绑定微信
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-weixin
* @param {Object} params
* @param {String} params.code 微信登录返回的code
* @returns
*/
bindWeixin
,
bindWeixin
,
/**
* 绑定QQ
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-qq
* @param {Object} params
* @param {String} params.code 小程序端QQ登录返回的code
* @param {String} params.accessToken APP端QQ登录返回的accessToken
* @returns
*/
bindQQ
,
bindQQ
,
/**
* 绑定支付宝账号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-alipay
* @param {Object} params
* @param {String} params.code 支付宝小程序登录返回的code参数
* @returns
*/
bindAlipay
,
bindAlipay
,
/**
* 绑定苹果账号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-apple
* @param {Object} params
* @param {String} params.identityToken 苹果登录返回identityToken
* @returns
*/
bindApple
,
bindApple
,
/**
* 更新密码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#update-pwd
* @param {object} params
* @param {string} params.oldPassword 旧密码
* @param {string} params.newPassword 新密码
* @returns {object}
*/
updatePwd
,
updatePwd
,
/**
* 通过短信验证码重置密码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#reset-pwd-by-sms
* @param {object} params
* @param {string} params.mobile 手机号
* @param {string} params.mobile 短信验证码
* @param {string} params.password 密码
* @param {string} params.captcha 图形验证码
* @returns {object}
*/
resetPwdBySms
,
resetPwdBySms
,
/**
* 注销账户
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#close-account
* @returns
*/
closeAccount
,
closeAccount
,
/**
* 获取账户账户简略信息
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-account-info
*/
getAccountInfo
,
getAccountInfo
,
/**
* 创建图形验证码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#create-captcha
* @param {Object} params
* @param {String} params.scene 图形验证码使用场景
* @returns
*/
createCaptcha
,
createCaptcha
,
/**
* 刷新图形验证码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#refresh-captcha
* @param {Object} params
* @param {String} params.scene 图形验证码使用场景
* @returns
*/
refreshCaptcha
,
refreshCaptcha
,
/**
* 发送短信验证码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#send-sms-code
* @param {Object} params
* @param {String} params.mobile 手机号
* @param {String} params.captcha 图形验证码
* @param {String} params.scene 短信验证码使用场景
* @returns
*/
sendSmsCode
,
sendSmsCode
,
/**
* 刷新token
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#refresh-token
*/
refreshToken
,
refreshToken
,
/**
* 接受邀请
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#accept-invite
* @param {Object} params
* @param {String} params.inviteCode 邀请码
* @returns
*/
acceptInvite
,
acceptInvite
,
/**
* 获取受邀用户
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-invited-user
* @param {Object} params
* @param {Number} params.level 获取受邀用户的级数,1表示直接邀请的用户
* @param {Number} params.limit 返回数据大小
* @param {Number} params.offset 返回数据偏移
* @param {Boolean} params.needTotal 是否需要返回总数
* @returns
*/
getInvitedUser
,
getInvitedUser
,
/**
* 更新device表的push_clien_id
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#set-push-cid
* @param {object} params
* @param {string} params.pushClientId 客户端pushClientId
* @returns
*/
setPushCid
,
setPushCid
,
/**
* 获取支持的登录方式
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-supported-login-type
* @param {Object} params
* @param {String} params.appId 应用AppId
* @param {String} params.platform 应用平台
* @returns
*/
getSupportedLoginType
getSupportedLoginType
}
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/account/close-account.js
浏览文件 @
b202e148
...
@@ -7,6 +7,7 @@ const {
...
@@ -7,6 +7,7 @@ const {
/**
/**
* 注销账户
* 注销账户
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#close-account
* @returns
* @returns
*/
*/
module
.
exports
=
async
function
()
{
module
.
exports
=
async
function
()
{
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/account/get-account-info.js
浏览文件 @
b202e148
...
@@ -41,6 +41,7 @@ function isAppleBound (userRecord) {
...
@@ -41,6 +41,7 @@ function isAppleBound (userRecord) {
/**
/**
* 获取账户账户简略信息
* 获取账户账户简略信息
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-account-info
*/
*/
module
.
exports
=
async
function
()
{
module
.
exports
=
async
function
()
{
const
{
const
{
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/account/reset-pwd-by-sms.js
浏览文件 @
b202e148
...
@@ -21,6 +21,7 @@ const PasswordUtils = require('../../lib/utils/password')
...
@@ -21,6 +21,7 @@ const PasswordUtils = require('../../lib/utils/password')
/**
/**
* 通过短信验证码重置密码
* 通过短信验证码重置密码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#reset-pwd-by-sms
* @param {object} params
* @param {object} params
* @param {string} params.mobile 手机号
* @param {string} params.mobile 手机号
* @param {string} params.mobile 短信验证码
* @param {string} params.mobile 短信验证码
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/account/update-pwd.js
浏览文件 @
b202e148
const
{
const
{
userCollection
userCollection
}
=
require
(
'
../../common/constants
'
)
}
=
require
(
'
../../common/constants
'
)
const
{
const
{
ERROR
ERROR
}
=
require
(
'
../../common/error
'
)
}
=
require
(
'
../../common/error
'
)
const
PasswordUtils
=
require
(
'
../../lib/utils/password
'
)
const
PasswordUtils
=
require
(
'
../../lib/utils/password
'
)
/**
/**
* 更新密码
* 更新密码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#update-pwd
* @param {object} params
* @param {object} params
* @param {string} params.oldPassword 旧密码
* @param {string} params.oldPassword 旧密码
* @param {string} params.newPassword 新密码
* @param {string} params.newPassword 新密码
* @returns {object}
* @returns {object}
*/
*/
module
.
exports
=
async
function
(
params
=
{})
{
module
.
exports
=
async
function
(
params
=
{})
{
const
schema
=
{
const
schema
=
{
oldPassword
:
'
string
'
,
// 防止密码规则调整导致旧密码无法更新
oldPassword
:
'
string
'
,
// 防止密码规则调整导致旧密码无法更新
newPassword
:
'
password
'
newPassword
:
'
password
'
}
}
this
.
middleware
.
validate
(
params
,
schema
)
this
.
middleware
.
validate
(
params
,
schema
)
const
uid
=
this
.
authInfo
.
uid
const
uid
=
this
.
authInfo
.
uid
const
getUserRes
=
await
userCollection
.
doc
(
uid
).
get
()
const
getUserRes
=
await
userCollection
.
doc
(
uid
).
get
()
const
userRecord
=
getUserRes
.
data
[
0
]
const
userRecord
=
getUserRes
.
data
[
0
]
if
(
!
userRecord
)
{
if
(
!
userRecord
)
{
throw
{
throw
{
errCode
:
ERROR
.
ACCOUNT_NOT_EXISTS
errCode
:
ERROR
.
ACCOUNT_NOT_EXISTS
}
}
}
}
const
{
const
{
oldPassword
,
oldPassword
,
newPassword
newPassword
}
=
params
}
=
params
const
passwordUtils
=
new
PasswordUtils
({
const
passwordUtils
=
new
PasswordUtils
({
passwordSecret
:
this
.
config
.
passwordSecret
passwordSecret
:
this
.
config
.
passwordSecret
})
})
const
{
const
{
success
:
checkPasswordSuccess
success
:
checkPasswordSuccess
}
=
passwordUtils
.
checkUserPassword
({
}
=
passwordUtils
.
checkUserPassword
({
password
:
oldPassword
,
password
:
oldPassword
,
passwordHash
:
userRecord
.
password
,
passwordHash
:
userRecord
.
password
,
passwordSecretVersion
:
userRecord
.
password_secret_version
,
passwordSecretVersion
:
userRecord
.
password_secret_version
,
autoRefresh
:
false
autoRefresh
:
false
})
})
if
(
!
checkPasswordSuccess
)
{
if
(
!
checkPasswordSuccess
)
{
throw
{
throw
{
errCode
:
ERROR
.
PASSWORD_ERROR
errCode
:
ERROR
.
PASSWORD_ERROR
}
}
}
}
const
{
const
{
passwordHash
,
passwordHash
,
version
version
}
=
passwordUtils
.
generatePasswordHash
({
}
=
passwordUtils
.
generatePasswordHash
({
password
:
newPassword
password
:
newPassword
})
})
await
userCollection
.
doc
(
uid
).
update
({
await
userCollection
.
doc
(
uid
).
update
({
password
:
passwordHash
,
password
:
passwordHash
,
password_secret_version
:
version
,
password_secret_version
:
version
,
valid_token_date
:
Date
.
now
()
// refreshToken时会校验,如果创建token时间在此时间点之前,则拒绝下发新token,返回token失效错误码
valid_token_date
:
Date
.
now
()
// refreshToken时会校验,如果创建token时间在此时间点之前,则拒绝下发新token,返回token失效错误码
})
})
// 执行更新密码操作后客户端应将用户退出重新登录
// 执行更新密码操作后客户端应将用户退出重新登录
return
{
return
{
errCode
:
0
errCode
:
0
}
}
}
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/admin/add-user.js
浏览文件 @
b202e148
...
@@ -11,6 +11,7 @@ const PasswordUtils = require('../../lib/utils/password')
...
@@ -11,6 +11,7 @@ const PasswordUtils = require('../../lib/utils/password')
/**
/**
* 新增用户
* 新增用户
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#add-user
* @param {Object} params
* @param {Object} params
* @param {String} params.username 用户名
* @param {String} params.username 用户名
* @param {String} params.password 密码
* @param {String} params.password 密码
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/dev/get-supported-login-type.js
浏览文件 @
b202e148
...
@@ -35,6 +35,7 @@ const ConfigUtils = require('../../lib/utils/config')
...
@@ -35,6 +35,7 @@ const ConfigUtils = require('../../lib/utils/config')
/**
/**
* 获取支持的登录方式
* 获取支持的登录方式
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-supported-login-type
* @param {Object} params
* @param {Object} params
* @param {String} params.appId 应用AppId
* @param {String} params.appId 应用AppId
* @param {String} params.platform 应用平台
* @param {String} params.platform 应用平台
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/fission/accept-invite.js
浏览文件 @
b202e148
...
@@ -4,6 +4,7 @@ const {
...
@@ -4,6 +4,7 @@ const {
/**
/**
* 接受邀请
* 接受邀请
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#accept-invite
* @param {Object} params
* @param {Object} params
* @param {String} params.inviteCode 邀请码
* @param {String} params.inviteCode 邀请码
* @returns
* @returns
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/fission/get-invited-user.js
浏览文件 @
b202e148
...
@@ -7,6 +7,7 @@ const {
...
@@ -7,6 +7,7 @@ const {
/**
/**
* 获取受邀用户
* 获取受邀用户
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-invited-user
* @param {Object} params
* @param {Object} params
* @param {Number} params.level 获取受邀用户的级数,1表示直接邀请的用户
* @param {Number} params.level 获取受邀用户的级数,1表示直接邀请的用户
* @param {Number} params.limit 返回数据大小
* @param {Number} params.limit 返回数据大小
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-alipay.js
浏览文件 @
b202e148
...
@@ -14,6 +14,7 @@ const {
...
@@ -14,6 +14,7 @@ const {
/**
/**
* 支付宝登录
* 支付宝登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-alipay
* @param {Object} params
* @param {Object} params
* @param {String} params.code 支付宝小程序客户端登录返回的code
* @param {String} params.code 支付宝小程序客户端登录返回的code
* @param {String} params.inviteCode 邀请码
* @param {String} params.inviteCode 邀请码
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-apple.js
浏览文件 @
b202e148
...
@@ -14,6 +14,7 @@ const {
...
@@ -14,6 +14,7 @@ const {
/**
/**
* 苹果登录
* 苹果登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-apple
* @param {Object} params
* @param {Object} params
* @param {String} params.identityToken 苹果登录返回的identityToken
* @param {String} params.identityToken 苹果登录返回的identityToken
* @param {String} params.nickname 用户昵称
* @param {String} params.nickname 用户昵称
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-qq.js
浏览文件 @
b202e148
...
@@ -19,6 +19,7 @@ const url = require('url')
...
@@ -19,6 +19,7 @@ const url = require('url')
/**
/**
* QQ登录
* QQ登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-qq
* @param {Object} params
* @param {Object} params
* @param {String} params.code QQ小程序登录返回的code参数
* @param {String} params.code QQ小程序登录返回的code参数
* @param {String} params.accessToken App端QQ登录返回的accessToken参数
* @param {String} params.accessToken App端QQ登录返回的accessToken参数
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-sms.js
浏览文件 @
b202e148
...
@@ -17,6 +17,7 @@ const {
...
@@ -17,6 +17,7 @@ const {
/**
/**
* 短信验证码登录
* 短信验证码登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-sms
* @param {Object} params
* @param {Object} params
* @param {String} params.mobile 手机号
* @param {String} params.mobile 手机号
* @param {String} params.code 短信验证码
* @param {String} params.code 短信验证码
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-univerify.js
浏览文件 @
b202e148
...
@@ -11,6 +11,7 @@ const {
...
@@ -11,6 +11,7 @@ const {
/**
/**
* App端一键登录
* App端一键登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-univerify
* @param {Object} params
* @param {Object} params
* @param {String} params.access_token APP端一键登录返回的access_token
* @param {String} params.access_token APP端一键登录返回的access_token
* @param {String} params.openid APP端一键登录返回的openid
* @param {String} params.openid APP端一键登录返回的openid
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login-by-weixin.js
浏览文件 @
b202e148
...
@@ -19,6 +19,7 @@ const url = require('url')
...
@@ -19,6 +19,7 @@ const url = require('url')
/**
/**
* 微信登录
* 微信登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-weixin
* @param {Object} params
* @param {Object} params
* @param {String} params.code 微信登录返回的code
* @param {String} params.code 微信登录返回的code
* @param {String} params.inviteCode 邀请码
* @param {String} params.inviteCode 邀请码
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/login/login.js
浏览文件 @
b202e148
...
@@ -15,6 +15,7 @@ const {
...
@@ -15,6 +15,7 @@ const {
/**
/**
* 用户名密码登录
* 用户名密码登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login
* @param {Object} params
* @param {Object} params
* @param {String} params.username 用户名
* @param {String} params.username 用户名
* @param {String} params.mobile 手机号
* @param {String} params.mobile 手机号
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/logout/logout.js
浏览文件 @
b202e148
...
@@ -4,6 +4,7 @@ const {
...
@@ -4,6 +4,7 @@ const {
}
=
require
(
'
../../common/constants
'
)
}
=
require
(
'
../../common/constants
'
)
/**
/**
* 用户退出登录
* 用户退出登录
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#logout
* @returns
* @returns
*/
*/
module
.
exports
=
async
function
()
{
module
.
exports
=
async
function
()
{
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/multi-end/authorize-app-login.js
浏览文件 @
b202e148
...
@@ -8,6 +8,7 @@ const {
...
@@ -8,6 +8,7 @@ const {
/**
/**
* 授权用户登录应用
* 授权用户登录应用
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#authorize-app-login
* @param {Object} params
* @param {Object} params
* @param {String} params.uid 用户id
* @param {String} params.uid 用户id
* @param {String} params.appId 授权的应用的AppId
* @param {String} params.appId 授权的应用的AppId
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/multi-end/remove-authorized-app.js
浏览文件 @
b202e148
...
@@ -5,6 +5,7 @@ const {
...
@@ -5,6 +5,7 @@ const {
/**
/**
* 移除用户登录授权
* 移除用户登录授权
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#remove-authorized-app
* @param {Object} params
* @param {Object} params
* @param {String} params.uid 用户id
* @param {String} params.uid 用户id
* @param {String} params.appId 取消授权的应用的AppId
* @param {String} params.appId 取消授权的应用的AppId
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/multi-end/set-authorized-app.js
浏览文件 @
b202e148
...
@@ -7,6 +7,7 @@ const {
...
@@ -7,6 +7,7 @@ const {
/**
/**
* 设置用户允许登录的应用列表
* 设置用户允许登录的应用列表
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#set-authorized-app
* @param {Object} params
* @param {Object} params
* @param {String} params.uid 用户id
* @param {String} params.uid 用户id
* @param {Array} params.appIdList 允许登录的应用AppId列表
* @param {Array} params.appIdList 允许登录的应用AppId列表
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/register/register-admin.js
浏览文件 @
b202e148
...
@@ -11,6 +11,7 @@ const {
...
@@ -11,6 +11,7 @@ const {
/**
/**
* 注册管理员
* 注册管理员
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#register-admin
* @param {Object} params
* @param {Object} params
* @param {String} params.username 用户名
* @param {String} params.username 用户名
* @param {String} params.password 密码
* @param {String} params.password 密码
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/register/register-user.js
浏览文件 @
b202e148
...
@@ -8,6 +8,7 @@ const {
...
@@ -8,6 +8,7 @@ const {
/**
/**
* 注册普通用户
* 注册普通用户
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#register-user
* @param {Object} params
* @param {Object} params
* @param {String} params.username 用户名
* @param {String} params.username 用户名
* @param {String} params.password 密码
* @param {String} params.password 密码
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-alipay.js
浏览文件 @
b202e148
...
@@ -14,6 +14,7 @@ const {
...
@@ -14,6 +14,7 @@ const {
/**
/**
* 绑定支付宝账号
* 绑定支付宝账号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-alipay
* @param {Object} params
* @param {Object} params
* @param {String} params.code 支付宝小程序登录返回的code参数
* @param {String} params.code 支付宝小程序登录返回的code参数
* @returns
* @returns
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-apple.js
浏览文件 @
b202e148
...
@@ -14,6 +14,7 @@ const {
...
@@ -14,6 +14,7 @@ const {
/**
/**
* 绑定苹果账号
* 绑定苹果账号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-apple
* @param {Object} params
* @param {Object} params
* @param {String} params.identityToken 苹果登录返回identityToken
* @param {String} params.identityToken 苹果登录返回identityToken
* @returns
* @returns
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-mobile-by-mp-weixin.js
浏览文件 @
b202e148
...
@@ -12,6 +12,7 @@ const {
...
@@ -12,6 +12,7 @@ const {
/**
/**
* 通过微信绑定手机号
* 通过微信绑定手机号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-mobile-by-mp-weixin
* @param {Object} params
* @param {Object} params
* @param {String} params.encryptedData 微信获取手机号返回的加密信息
* @param {String} params.encryptedData 微信获取手机号返回的加密信息
* @param {String} params.iv 微信获取手机号返回的初始向量
* @param {String} params.iv 微信获取手机号返回的初始向量
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-mobile-by-sms.js
浏览文件 @
b202e148
...
@@ -17,6 +17,7 @@ const {
...
@@ -17,6 +17,7 @@ const {
/**
/**
* 通过短信验证码绑定手机号
* 通过短信验证码绑定手机号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-mobile-by-sms
* @param {Object} params
* @param {Object} params
* @param {String} params.mobile 手机号
* @param {String} params.mobile 手机号
* @param {String} params.code 短信验证码
* @param {String} params.code 短信验证码
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-mobile-by-univerify.js
浏览文件 @
b202e148
...
@@ -11,6 +11,7 @@ const {
...
@@ -11,6 +11,7 @@ const {
/**
/**
* 通过一键登录绑定手机号
* 通过一键登录绑定手机号
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-mobile-by-univerify
* @param {Object} params
* @param {Object} params
* @param {String} params.openid APP端一键登录返回的openid
* @param {String} params.openid APP端一键登录返回的openid
* @param {String} params.access_token APP端一键登录返回的access_token
* @param {String} params.access_token APP端一键登录返回的access_token
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-qq.js
浏览文件 @
b202e148
...
@@ -14,6 +14,7 @@ const {
...
@@ -14,6 +14,7 @@ const {
/**
/**
* 绑定QQ
* 绑定QQ
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-qq
* @param {Object} params
* @param {Object} params
* @param {String} params.code 小程序端QQ登录返回的code
* @param {String} params.code 小程序端QQ登录返回的code
* @param {String} params.accessToken APP端QQ登录返回的accessToken
* @param {String} params.accessToken APP端QQ登录返回的accessToken
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-weixin.js
浏览文件 @
b202e148
...
@@ -17,6 +17,7 @@ const {
...
@@ -17,6 +17,7 @@ const {
/**
/**
* 绑定微信
* 绑定微信
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#bind-weixin
* @param {Object} params
* @param {Object} params
* @param {String} params.code 微信登录返回的code
* @param {String} params.code 微信登录返回的code
* @returns
* @returns
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/refresh-token.js
浏览文件 @
b202e148
/**
/**
* 刷新token
* 刷新token
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#refresh-token
*/
*/
module
.
exports
=
async
function
()
{
module
.
exports
=
async
function
()
{
const
{
const
{
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/set-push-cid.js
浏览文件 @
b202e148
...
@@ -7,6 +7,7 @@ const {
...
@@ -7,6 +7,7 @@ const {
/**
/**
* 更新device表的push_clien_id
* 更新device表的push_clien_id
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#set-push-cid
* @param {object} params
* @param {object} params
* @param {string} params.pushClientId 客户端pushClientId
* @param {string} params.pushClientId 客户端pushClientId
* @returns
* @returns
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/create-captcha.js
浏览文件 @
b202e148
...
@@ -7,6 +7,7 @@ const {
...
@@ -7,6 +7,7 @@ const {
/**
/**
* 创建图形验证码
* 创建图形验证码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#create-captcha
* @param {Object} params
* @param {Object} params
* @param {String} params.scene 图形验证码使用场景
* @param {String} params.scene 图形验证码使用场景
* @returns
* @returns
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/refresh-captcha.js
浏览文件 @
b202e148
...
@@ -7,6 +7,7 @@ const {
...
@@ -7,6 +7,7 @@ const {
/**
/**
* 刷新图形验证码
* 刷新图形验证码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#refresh-captcha
* @param {Object} params
* @param {Object} params
* @param {String} params.scene 图形验证码使用场景
* @param {String} params.scene 图形验证码使用场景
* @returns
* @returns
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/send-email-code.js
浏览文件 @
b202e148
/**
/**
* 发送邮箱验证码,可用于登录、注册、绑定邮箱、修改密码等操作
* 发送邮箱验证码,可用于登录、注册、绑定邮箱、修改密码等操作
* @tutorial
* @param {Object} params
* @param {Object} params
* @param {String} params.email 邮箱
* @param {String} params.email 邮箱
* @param {String} params.scene 使用场景
* @param {String} params.scene 使用场景
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/send-email-link.js
浏览文件 @
b202e148
/**
/**
* 发送邮箱链接,可用于登录、注册、绑定邮箱、修改密码等操作
* 发送邮箱链接,可用于登录、注册、绑定邮箱、修改密码等操作
* @tutorial
* @param {Object} params
* @param {Object} params
* @param {String} params.email 邮箱
* @param {String} params.email 邮箱
* @param {String} params.scene 使用场景
* @param {String} params.scene 使用场景
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/verify/send-sms-code.js
浏览文件 @
b202e148
...
@@ -13,6 +13,7 @@ const {
...
@@ -13,6 +13,7 @@ const {
/**
/**
* 发送短信验证码
* 发送短信验证码
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#send-sms-code
* @param {Object} params
* @param {Object} params
* @param {String} params.mobile 手机号
* @param {String} params.mobile 手机号
* @param {String} params.captcha 图形验证码
* @param {String} params.captcha 图形验证码
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录