提交 0672ab8d 编写于 作者: DCloud_JSON's avatar DCloud_JSON

更新 注册/登录后:userInfo仅返回inviteCode,nickname,username,_id

上级 b7dbac6a
...@@ -324,7 +324,11 @@ exports.main = async (event, context) => { ...@@ -324,7 +324,11 @@ exports.main = async (event, context) => {
password, password,
nickname, nickname,
inviteCode inviteCode
}); });
if(typeof(res.userInfo) == 'object'){
const {inviteCode,nickname,username,_id} = res.userInfo;
res.userInfo = {inviteCode,nickname,username,_id};
}
if (res.code === 0) { if (res.code === 0) {
await registerSuccess(res) await registerSuccess(res)
} }
...@@ -354,8 +358,11 @@ exports.main = async (event, context) => { ...@@ -354,8 +358,11 @@ exports.main = async (event, context) => {
res.type = 'login' res.type = 'login'
await uniIdLog(res); await uniIdLog(res);
needCaptcha = await isNeedCaptcha(); needCaptcha = await isNeedCaptcha();
} }
if(typeof(res.userInfo) == 'object'){
const {inviteCode,nickname,username,_id} = res.userInfo;
res.userInfo = {inviteCode,nickname,username,_id};
}
res.needCaptcha = needCaptcha; res.needCaptcha = needCaptcha;
break; break;
case 'loginByWeixin': case 'loginByWeixin':
...@@ -634,7 +641,8 @@ exports.main = async (event, context) => { ...@@ -634,7 +641,8 @@ exports.main = async (event, context) => {
userInfo userInfo
} = await uniID.getUserInfo({ } = await uniID.getUserInfo({
uid: params.uid uid: params.uid
}) })
console.error('getUserInfo',userInfo);
if (userInfo.role.indexOf('admin') === -1) { if (userInfo.role.indexOf('admin') === -1) {
res = { res = {
code: 403, code: 403,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册