diff --git a/App.vue b/App.vue
index 180858f9e6d21f68e61864b0e22a358a5945e933..e96fdc44496b1d349e19b950d6bc74bbf8baa97a 100644
--- a/App.vue
+++ b/App.vue
@@ -56,7 +56,7 @@
// #endif
},
onShow: function() {
- console.log('App Show')
+ console.log('App Show')
},
onHide: function() {
console.log('App Hide')
diff --git a/changelog.md b/changelog.md
index 63a81b6d1d078b0f231acd8f2a210ed7de915e18..878f173771dfaaf6e7388c39a32105eb605ec3e9 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,9 @@
+## 1.0.22(2021-06-22)
+1. 新增一键登录授权界面的其他快捷登陆按钮
+2. 优化uni-quick-login组件代码
+3. 调整隐私政策协议框勾选逻辑:在登陆页面已勾选,同步勾选。如果没勾选需要手动勾选(为符合应用市场上架要求)
+4. 调整登陆页隐私政策协议框位置。
+5. 增强路由拦截,新增判断token是否过期。
## 1.0.21(2021-06-21)
优化:uni_modules模式使用uni-id-cf,方便uni-starter与uniCloud-admin的uni-id-cf同步更新。
## 1.0.20(2021-06-18)
diff --git a/common/appInit.js b/common/appInit.js
index fc99de6ebdd07c9fafdc6e991a471668ddf308b5..605630e2521874ae67605d30864fba8e4427a774 100644
--- a/common/appInit.js
+++ b/common/appInit.js
@@ -8,7 +8,7 @@ import interceptorChooseImage from '@/uni_modules/json-interceptor-chooseImage/j
// #endif
const db = uniCloud.database()
export default function() {
-
+
// #ifndef H5
setTimeout(()=>{
// #endif
@@ -33,6 +33,7 @@ export default function() {
code, // 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue
message
}) {
+ console.log('onDBError');
// 处理错误
console.log(code,message);
if([
@@ -199,8 +200,6 @@ export default function() {
tokenExpired
})
}
-
- console.log(e.result.code);
switch (e.result.code){
case 403:
uni.navigateTo({
@@ -212,6 +211,11 @@ export default function() {
url: "/pages/ucenter/login-page/index/index"
})
break;
+ case 30203:
+ uni.navigateTo({
+ url: "/pages/ucenter/login-page/index/index"
+ })
+ break;
case 50101:
uni.showToast({
title: e.result.msg,
@@ -235,11 +239,13 @@ export default function() {
// console.log(e);
//获取用户的token
const token = uni.getStorageSync('uni_id_token')
+ //token是否已失效
+ const tokenExpired = (uni.getStorageSync('uni_id_token_expired') - Date.now()) < 0
//获取当前页面路径(即url去掉"?"和"?"后的参数)
const url = e.url.split('?')[0]
//控制登录优先级
let pages = getCurrentPages();
- if (
+ if ( //判断当前窗口是否为登陆页面,如果是则不重定向路由
url == '/pages/ucenter/login-page/index/index'
&&
pages[pages.length - 1].route.split('/')[2]!='login-page'
@@ -253,7 +259,7 @@ export default function() {
}
}else{
//拦截强制登录页面
- if (needLogin.includes(url) && token == '') {
+ if (needLogin.includes(url) && (token == ''||tokenExpired)) {
uni.showToast({
title: '请先登录',
icon: 'none'
diff --git a/components/uni-quick-login/uni-quick-login.vue b/components/uni-quick-login/uni-quick-login.vue
index c1ed8f812b2ae18ac82997ed530e665f50ff0786..1fd8f73a587d02af74819d2cd093987bd94f882f 100644
--- a/components/uni-quick-login/uni-quick-login.vue
+++ b/components/uni-quick-login/uni-quick-login.vue
@@ -18,6 +18,9 @@
computed: {
loginConfig() {
return getApp().globalData.config.router.login
+ },
+ agreements() {
+ return getApp().globalData.config.about.agreements || []
}
},
data() {
@@ -35,126 +38,110 @@
"path": "/pages/ucenter/login-page/index/index"
}
],
- oauthServices: []
+ oauthServices: [],
+ config: {
+ "weixin": {
+ "text": "微信登录",
+ "logo": "/static/uni-quick-login/wechat.png",
+ },
+ "apple": {
+ "text": "苹果登录",
+ "logo": "/static/uni-quick-login/apple.png",
+ },
+ "univerify": {
+ "text": "一键登录",
+ "logo": "/static/uni-quick-login/univerify.png",
+ },
+ "qq": {
+ "text": "QQ登录",//暂未提供该登录方式的接口示例
+ "logo": "/static/uni-quick-login/univerify.png",
+ },
+ "xiaomi": {
+ "text": "小米登录",//暂未提供该登录方式的接口示例
+ "logo": "/static/uni-quick-login/univerify.png",
+ },
+ "sinaweibo": {
+ "text": "微博登录",//暂未提供该登录方式的接口示例
+ "logo": "/static/uni-quick-login/univerify.png",
+ }
+ },
+ univerifyStyle:{ //一键登录弹出窗的样式配置参数
+ "fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
+ "backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff
+ "buttons": { // 自定义登陆按钮
+ "iconWidth": "45px", // 图标宽度(高度等比例缩放) 默认值:45px
+ "list": []
+ },
+ "privacyTerms": {
+ "defaultCheckBoxState": false, // 条款勾选框初始状态 默认值: true
+ "textColor": "#BBBBBB", // 文字颜色 默认值:#BBBBBB
+ "termsColor": "#5496E3", // 协议文字颜色 默认值: #5496E3
+ "prefix": "我已阅读并同意", // 条款前的文案 默认值:“我已阅读并同意”
+ "suffix": "并使用本机号码登录", // 条款后的文案 默认值:“并使用本机号码登录”
+ "privacyItems": []
+ }
+ }
}
- },
+ },
+ watch: {
+ agree(agree) {
+ this.univerifyStyle.privacyTerms.defaultCheckBoxState = agree
+ }
+ },
props: {
agree: {
type: Boolean,
default () {
return false
}
- },
- config: {
- type: Object,
- default () {
- return {
- "weixin": {
- "text": "微信登录",
- "logo": "/static/uni-quick-login/wechat.png",
- "isChecked": true
- },
- "apple": {
- "text": "苹果登录",
- "logo": "/static/uni-quick-login/apple.png",
- "isChecked": true
- },
- "univerify": {
- "text": "一键登录",
- "logo": "/static/uni-quick-login/univerify.png",
- "isChecked": true
- },
- "qq": {
- "text": "QQ登录",
- "logo": "/static/uni-quick-login/univerify.png",
- "isChecked": false //暂未提供该登录方式的接口示例
- },
- "xiaomi": {
- "text": "小米登录",
- "logo": "/static/uni-quick-login/univerify.png",
- "isChecked": false //暂未提供该登录方式的接口示例
- },
- "sinaweibo": {
- "text": "微博登录",
- "logo": "/static/uni-quick-login/univerify.png",
- "isChecked": false //暂未提供该登录方式的接口示例
- }
- }
- }
- },
- univerifyStyle: {
- type: Object,
- default () {
- return { //一键登录弹出窗的样式配置参数
- "fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
- "backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff
- }
- }
- },
- },
- created() {
- // console.log('loginConfig', this.loginConfig);
- // console.log('this.getRoute(1)', this.getRoute(1));
- let servicesList = this.servicesList
- //去掉当前页面对应的登录选项
- for (var i = 0; i < servicesList.length; i++) {
- if (servicesList[i].path == this.getRoute(1)) {
- servicesList.splice(i, 1)
- }
}
- //去掉配置项中不存在的项
- for (var i = 0; i < servicesList.length; i++) {
- if (!this.loginConfig.includes(servicesList[i].id)) {
- console.log('去掉配置项中不存在的项', servicesList[i].id);
- servicesList.splice(i, 1)
- }
- }
- // console.log('servicesList', servicesList);
},
- mounted() {
- //获取当前环境能用的快捷登录方式
- // #ifdef APP-PLUS
- plus.oauth.getServices(oauthServices => {
- this.oauthServices = oauthServices
- oauthServices.forEach(({
- id
- }) => {
- if (this.config[id].isChecked && this.loginConfig.includes(id)) {
- if (id == 'weixin') {
- if (!plus.runtime.isApplicationExist({
- pname: 'com.tencent.mm',
- action: 'weixin://'
- })) {
- console.log("微信应用未安装");
- return
- }
- }
- this.servicesList.push({
- ...this.config[id],
- id
- })
- }
- })
- // console.log('oauthServices',oauthServices);
- }, err => {
- uni.hideLoading()
- uni.showModal({
- title: '获取服务供应商失败:' + JSON.stringify(err),
- showCancel: false,
- confirmText: '知道了'
- });
- console.error('获取服务供应商失败:' + JSON.stringify(err));
- })
- // #endif
- // #ifdef MP-WEIXIN
- let id = 'weixin'
- if (this.loginConfig.includes(id)) {
- this.servicesList.push({
- ...this.config[id],
- id
- })
- }
+ async created() {
+ this.univerifyStyle.privacyTerms.privacyItems = this.agreements
+
+ let servicesList = this.servicesList
+ //获取当前环境能用的快捷登录方式
+ // #ifdef MP-WEIXIN
+ let id = 'weixin'
+ if (this.loginConfig.includes(id)) {
+ servicesList.push({
+ ...this.config[id],
+ id
+ })
+ }
// #endif
+ // #ifdef APP-PLUS
+ this.oauthServices = await new Promise((callBack)=>{
+ plus.oauth.getServices(oauthServices => {
+ callBack(oauthServices.filter(({nativeClient,id})=>nativeClient&&this.loginConfig.includes(id)))
+ //只返回1.应用支持 && 2.手机已安装对应客户端 && 3.uni-starter.config.js配置项中存在的快捷登录方式
+ }, err => {
+ callBack([])
+ uni.hideLoading()
+ uni.showModal({
+ title: '获取服务供应商失败:' + JSON.stringify(err),
+ showCancel: false,
+ confirmText: '知道了'
+ });
+ console.error('获取服务供应商失败:' + JSON.stringify(err));
+ })
+ })
+ // #endif
+ //添加已配置且可用的第三方快捷登陆项
+ servicesList = servicesList.concat(this.oauthServices.map( ({id})=>{
+ return {...this.config[id],id}
+ }))
+ //设置一键登录功能底下的快捷登陆按钮
+ servicesList.forEach(({id,logo})=>{
+ if(id != 'univerify'){
+ this.univerifyStyle.buttons.list.push({"iconPath":logo,"provider":id})
+ }
+ })
+ //去掉当前页面对应的登录选项
+ this.servicesList = servicesList.filter(item=>{
+ return item.path != this.getRoute(1)
+ })
+ console.log('servicesList',servicesList,this.servicesList);
},
methods: {
...mapMutations({
@@ -179,7 +166,7 @@
}
},
login_before(type, navigateBack = true) {
- if (!this.agree) {
+ if (!this.agree&&type!='univerify') {
return uni.showToast({
title: '你未同意隐私政策协议',
icon: 'none'
@@ -218,7 +205,7 @@
"provider": type,
"univerifyStyle": this.univerifyStyle,
complete: (e) => {
- console.log(9527, e);
+ console.log(e);
},
success: async e => {
console.log(e);
@@ -249,6 +236,12 @@
icon: 'none'
});
}
+ if (err.errMsg) {
+ uni.showToast({
+ title: "一键登录:" + err.errMsg,
+ icon: 'none'
+ });
+ }
switch (err.errCode) {
case 30002:
console.log('在一键登录界面,点击其他登录方式');
@@ -272,17 +265,14 @@
title: '点击了第三方登陆',
icon: 'none'
});
- switch (err.index) {
- case 0:
- this.login_before('weixin', false)
- break;
- case 1:
- this.login_before('apple', false)
- break;
- default:
- break;
+ console.log('点击了第三方登陆,provider:',err.provider);
+ let {path} = this.servicesList.find(item=>item.id==err.provider)||{}
+ console.log('path',path);
+ if(path&&path!=this.getRoute(1)){ //存在路径,且并不是当前已经打开的路径
+ this.to(path)
+ }else{
+ this.login_before(err.provider)
}
-
break;
default:
console.log(9527, err);
@@ -297,12 +287,13 @@
console.log({
params,
type
- });
- let action = 'loginBy'+ type.trim().toLowerCase().replace(type[0], type[0].toUpperCase())
+ });
+ let action = 'loginBy' + type.trim().toLowerCase().replace(type[0], type[0].toUpperCase())
uniCloud.callFunction({
name: 'uni-id-cf',
data: {
- action,params
+ action,
+ params
},
success: ({
result
@@ -316,12 +307,17 @@
loginSuccess(result)
delete result.userInfo.token
this.setUserInfo(result.userInfo)
+ } else {
+ uni.showModal({
+ content: result.msg,
+ showCancel: false
+ });
}
},
complete: () => {
uni.hideLoading()
}
- })
+ })
},
async getUserInfo(e) {
return new Promise((resolve, reject) => {
diff --git a/components/uni-send-sms-code/uni-send-sms-code.vue b/components/uni-send-sms-code/uni-send-sms-code.vue
index d58cf7432e5f8bd94279bf5d30cedc75bf036b26..7df82fa6ed945415b313cb210ccc0de81ff19e30 100644
--- a/components/uni-send-sms-code/uni-send-sms-code.vue
+++ b/components/uni-send-sms-code/uni-send-sms-code.vue
@@ -85,13 +85,20 @@
},
success: ({result}) => {
console.log(result);
- uni.showToast({
- title: "短信验证码发送成功",
- icon: 'none'
- });
- this.reverseNumber = Number(this.count);
- this.getCode();
- this.$emit('getCode');
+ if(result.code===0){
+ uni.showToast({
+ title: "短信验证码发送成功",
+ icon: 'none'
+ });
+ this.reverseNumber = Number(this.count);
+ this.getCode();
+ this.$emit('getCode');
+ }else{
+ uni.showModal({
+ content: result.msg,
+ showCancel: false
+ });
+ }
}
})
},
diff --git a/main.js b/main.js
index 4b4275845110f6e42e238b88698d6a3cdd290054..9139f7d4e8286acc8b23dadd11ab7c4e6d598ad6 100644
--- a/main.js
+++ b/main.js
@@ -6,7 +6,6 @@ import openApp from './common/openApp.js';
Vue.config.productionTip = false
openApp();
App.mpType = 'app'
-
const app = new Vue({
...App,
store
diff --git a/package.json b/package.json
index 2a9e86cfc7ef420873c412b7b1601d5d90ab7482..2a0a1e295879489ba713a5b335d06bb1a535a8ab 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"id": "uni-starter",
"displayName": "uni-starter",
- "version": "1.0.21",
+ "version": "1.0.22",
"description": "云端一体应用快速开发基本项目模版",
"keywords": [
"uni-starter",
diff --git a/pages/ucenter/login-page/common/login-page.css b/pages/ucenter/login-page/common/login-page.css
index 579819e0390ee49dd0689eda24b3e3feeeedf19b..0fa69907552db54837ce476a48afd74a66b4e34a 100644
--- a/pages/ucenter/login-page/common/login-page.css
+++ b/pages/ucenter/login-page/common/login-page.css
@@ -5,7 +5,7 @@
}
.input-box{
padding:0 15px;
- margin-top: 15px;
+ margin-bottom: 10px;
background-color: #F8F8F8;
border-radius: 6px;
font-size: 28rpx;
@@ -17,8 +17,8 @@
color: #FFFFFF;
}
.input-box,.get-code{
- height: 50px;
- line-height: 50px;
+ height: 45px;
+ line-height: 45px;
}
.title{
text-align: center;
diff --git a/pages/ucenter/login-page/common/loginSuccess.js b/pages/ucenter/login-page/common/loginSuccess.js
index d5d16835c8ad2daec6a0023df0e56c5c1bbc6559..edaef77cbc7193089dac2a2a8a7918e76df9af45 100644
--- a/pages/ucenter/login-page/common/loginSuccess.js
+++ b/pages/ucenter/login-page/common/loginSuccess.js
@@ -4,11 +4,6 @@ export default function(result){
icon: 'none'
});
console.log('登录成功',result);
- uni.setStorageSync('uni_id_uid', result.uid)
- uni.setStorageSync('uni_id_token', result.token)
- uni.setStorageSync('uni_id_token_expired', result.tokenExpired)
- //delete result.userInfo.token
- // this.setUserInfo(result.userInfo)
var delta = 0//判断需要返回几层
let pages = getCurrentPages();
diff --git a/pages/ucenter/login-page/index/index.vue b/pages/ucenter/login-page/index/index.vue
index 279bfd0feb543c347f48808c971b9490bc54796a..78fda3ef231158f77bb9848781ee44453faedc49 100644
--- a/pages/ucenter/login-page/index/index.vue
+++ b/pages/ucenter/login-page/index/index.vue
@@ -2,15 +2,15 @@
登录后即可展示自己
-
-
+
+
未注册的手机号验证通过后将自动注册
-
+
@@ -20,59 +20,19 @@
data() {
return {
phone: "",
- agree: false,
- univerifyStyle: {
- "fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
- "backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff
- "buttons": { // 自定义登陆按钮
- "iconWidth": "45px", // 图标宽度(高度等比例缩放) 默认值:45px
- "list": []
- },
- "privacyTerms": {
- "defaultCheckBoxState": "true", // 条款勾选框初始状态 默认值: true
- "textColor": "#BBBBBB", // 文字颜色 默认值:#BBBBBB
- "termsColor": "#5496E3", // 协议文字颜色 默认值: #5496E3
- "prefix": "我已阅读并同意", // 条款前的文案 默认值:“我已阅读并同意”
- "suffix": "并使用本机号码登录", // 条款后的文案 默认值:“并使用本机号码登录”
- "privacyItems": []
- }
- }
+ agree: false
}
},
computed: {
isPhone() {
return /^1\d{10}$/.test(this.phone);
- },
- agreements() {
- return getApp().globalData.config.about.agreements || []
}
},
onLoad(e) {
- uni.getProvider({
- service: 'oauth',
- success: res => {
- if (~res.provider.indexOf('weixin')&&plus.runtime.isApplicationExist({
- pname: 'com.tencent.mm',
- action: 'weixin://'
- })) {
- this.univerifyStyle.buttons.list.push({
- "iconPath": "/static/uni-quick-login/wechat.png"
- })
- }
- if (~res.provider.indexOf('apple')) {
- this.univerifyStyle.buttons.list.push({
- "iconPath": "/static/uni-quick-login/apple.png"
- })
- }
- }
- });
-
-
//是否优先启动一键登录。即:页面一加载就启动一键登录
univerify_first = e.univerify_first
//#ifdef APP-PLUS
if (univerify_first) {
- this.univerifyStyle.privacyTerms.privacyItems = this.agreements
const pages = getCurrentPages();
currentWebview = pages[pages.length - 1].$getAppWebview();
currentWebview.setStyle({
@@ -85,7 +45,6 @@
//#ifdef APP-PLUS
if (univerify_first) {
// console.log('开始一键登录');
- this.agree = true
setTimeout(() => {
this.$refs.uniQuickLogin.login_before('univerify')
}, 100)
diff --git a/pages/ucenter/login-page/phone-code/phone-code.vue b/pages/ucenter/login-page/phone-code/phone-code.vue
index 70a8dbb96bf70877febcff3a274a8454c4730ec9..731e37f8864e0f8626450ef8db3bc39e1aa1cf67 100644
--- a/pages/ucenter/login-page/phone-code/phone-code.vue
+++ b/pages/ucenter/login-page/phone-code/phone-code.vue
@@ -52,7 +52,14 @@
},
},
success: ({result}) => {
- this.loginSuccess(result)
+ if(result.code === 0){
+ this.loginSuccess(result)
+ }else{
+ uni.showModal({
+ content: result.msg,
+ showCancel: false
+ });
+ }
}
})
diff --git a/pages/ucenter/login-page/pwd-login/pwd-login.vue b/pages/ucenter/login-page/pwd-login/pwd-login.vue
index a6a7c1ea45af35c441e1159f6f58729965f1908b..ac17d007d791625f86eafe608062b39e6d4ef0ff 100644
--- a/pages/ucenter/login-page/pwd-login/pwd-login.vue
+++ b/pages/ucenter/login-page/pwd-login/pwd-login.vue
@@ -2,13 +2,13 @@
用户名密码登录
-
-
+
+
@@ -108,6 +108,11 @@
success: ({result}) => {
if (result.code === 0) {
this.captchaBase64 = result.captchaBase64
+ }else{
+ uni.showModal({
+ content: result.msg,
+ showCancel: false
+ });
}
}
})
diff --git a/pages/ucenter/login-page/register/register.vue b/pages/ucenter/login-page/register/register.vue
index 1f8f4a013efa96c06d87215fb8359bb6c301ecf5..38193998f11626b214cc806a8a6a1f0e7ce74916 100644
--- a/pages/ucenter/login-page/register/register.vue
+++ b/pages/ucenter/login-page/register/register.vue
@@ -73,6 +73,11 @@ import mixin from '../common/login-page.mixin.js';
console.log(result);
if(result.code === 0){
this.loginSuccess(result)
+ }else{
+ uni.showModal({
+ content: result.msg,
+ showCancel: false
+ });
}
}
})
diff --git a/pages/ucenter/ucenter.vue b/pages/ucenter/ucenter.vue
index 020a5278739407228b7232287c83d2e888877542..67751e1b3e6cc8b02a5021daec013613c62035d8 100644
--- a/pages/ucenter/ucenter.vue
+++ b/pages/ucenter/ucenter.vue
@@ -1,5 +1,5 @@
-
+
@@ -35,7 +35,6 @@
import uniShare from 'uni_modules/uni-share/js_sdk/uni-share.js';
const db = uniCloud.database();
- const dbCollectionName = 'uni-id-scores';
export default {
data() {
return {
@@ -200,7 +199,8 @@
uni.showLoading({
mask: true
})
- db.collection(dbCollectionName).where('user_id == $env.uid').field('score,balance').get().then((res) => {
+ db.collection("uni-id-scores").where('user_id == $env.uid').field('score,balance').get().then((res) => {
+ console.log(res);
const data = res.result.data[0];
let msg = '';
msg = data ? ('当前积分为' + data.balance) : '当前无积分';
diff --git a/pages/ucenter/userinfo/userinfo.vue b/pages/ucenter/userinfo/userinfo.vue
index 66ceb301fd579526ab563b670ef3f1d80a079747..466bd7e27399e77c28c4520b92e2dca3467b6448 100644
--- a/pages/ucenter/userinfo/userinfo.vue
+++ b/pages/ucenter/userinfo/userinfo.vue
@@ -83,7 +83,7 @@
uni.closeAuthView()
}else{
uni.showModal({
- content: JSON.stringify(result.msg),
+ content: result.msg,
showCancel: false,
complete() {
uni.closeAuthView()
diff --git a/store/modules/user.js b/store/modules/user.js
index 2be02d94b55cd65319d47b3f23c4a3e4caea2140..91d34fb8aceae34840a513dc6b9426ed6118e54e 100644
--- a/store/modules/user.js
+++ b/store/modules/user.js
@@ -1,6 +1,5 @@
// 上次启动时的用户信息
let userInfoHistory = uni.getStorageSync('userInfo') || {};
-
let state = {
//是否已经登录
hasLogin: Boolean(Object.keys(userInfoHistory).length),
@@ -22,8 +21,13 @@ let state = {
state.info = Object.assign({}, _info, info);
//设置为已经登录
state.hasLogin = true;
+ console.log('state.info',state.info);
//存储最新的用户数据到本地持久化存储
uni.setStorageSync('userInfo', state.info);
+ uni.setStorageSync('uni_id_uid', state.info._id)
+ uni.setStorageSync('uni_id_token', state.info.token)
+ uni.setStorageSync('uni_id_token_expired', state.info.tokenExpired)
+
},
logout(state) {
state.info = {};
diff --git a/uni-starter.config.js b/uni-starter.config.js
index 1519f3958a4b6e1dbb6fb18deac1b57232f20bf3..e1592802b89bce66b0d585f8e089e8085009b85f 100644
--- a/uni-starter.config.js
+++ b/uni-starter.config.js
@@ -26,7 +26,7 @@ module.exports = {
"/pages/ucenter/userinfo/uploadCutImageToUnicloud",
"/uni_modules/uni-feedback/pages/uni-feedback/add"
],
- "login": ["username","smsCode", "univerify", "weixin", "apple"],
+ "login": ["univerify","smsCode","username", "weixin", "apple"],
/*
根据数组的第0项,决定登录方式的第一优先级。
未列举到的,或设备环境不支持的选项,将被隐藏。
diff --git a/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
index 17500c4c354799821de17837f0cbce79e080fa33..eec971ace8e7928a42d7013c5fbf43010228c739 100644
--- a/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
+++ b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
@@ -1,7 +1,7 @@
{
"passwordSecret": "passwordSecret-demo",
"tokenSecret": "tokenSecret-demo",
- "tokenExpiresIn": 7200,
+ "tokenExpiresIn": 1,
"tokenExpiresThreshold": 600,
"passwordErrorLimit": 6,
"bindTokenToDevice": false,
diff --git a/uni_modules/uni-id-cf/uniCloud/cloudfunctions/uni-id-cf/index.js b/uni_modules/uni-id-cf/uniCloud/cloudfunctions/uni-id-cf/index.js
index facf2804d13ae75efda108f12beae69d1ed411c0..5937982cc6cef865fe7272c321a9a88cc8a4adac 100644
--- a/uni_modules/uni-id-cf/uniCloud/cloudfunctions/uni-id-cf/index.js
+++ b/uni_modules/uni-id-cf/uniCloud/cloudfunctions/uni-id-cf/index.js
@@ -92,7 +92,10 @@ exports.main = async (event, context) => {
})
}
//4.记录成功登录的日志方法
- const loginLog = async (res = {}) => {
+ const loginLog = async (res = {}) => {
+ if(res.code != 0){
+ return false
+ }
const now = Date.now()
const uniIdLogCollection = db.collection('uni-id-log')
let logData = {
@@ -113,7 +116,8 @@ exports.main = async (event, context) => {
if (res.type == 'register') {
await registerSuccess(res.uid)
} else {
- if (Object.keys(deviceInfo).length) {
+ if (Object.keys(deviceInfo).length) {
+ console.log(979797,{deviceInfo,user_id: res});
//更新当前用户设备信息
await db.collection('uni-id-device').where({
user_id: res.uid
@@ -212,9 +216,7 @@ exports.main = async (event, context) => {
...params,
queryField: ['username', 'email', 'mobile']
});
- if (res.code === 0) {
- await loginLog(res);
- }
+ await loginLog(res);
needCaptcha = await getNeedCaptcha();
}
diff --git a/uni_modules_tools/change_after.js b/uni_modules_tools/change_after.js
index 714bbd14b06e3c45dfe5d4f46474e108177047b2..46f897b9f2f35a96582b96defddac47cc2ee93a6 100644
--- a/uni_modules_tools/change_after.js
+++ b/uni_modules_tools/change_after.js
@@ -1,7 +1,7 @@
const fs = require('fs');
module.exports = function(){
console.log('开始执行脚本change_after');
- let changelog = fs.readFileSync(process.cwd()+'/changelog.md', 'utf-8').split("\n")[1];
+ let changelog = fs.readFileSync(process.cwd() + '/changelog.md', 'utf-8').split("##")[1].split("\n").slice(1).join(' ');
console.log(changelog);
// 这里是修改完相关敏感配置后执行的脚本,你可以在这里自定义逻辑,
diff --git a/uni_modules_tools/copy/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json b/uni_modules_tools/copy/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
index 25f8fe6b69214a7bf713f0ac8f6d68c2450f372c..8ae0b786929c8e4d528b9bdc366d9d525c856533 100644
--- a/uni_modules_tools/copy/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
+++ b/uni_modules_tools/copy/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
@@ -1,7 +1,7 @@
{
"passwordSecret": "passwordSecret-demo",
"tokenSecret": "tokenSecret-demo",
- "tokenExpiresIn": 7200,
+ "tokenExpiresIn": 1,
"tokenExpiresThreshold": 600,
"passwordErrorLimit": 6,
"bindTokenToDevice": false,