From 48708a5d8e7658449150106e715a9fd7476b9485 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 23 Nov 2020 23:40:48 +0800 Subject: [PATCH] show confirm dialog before re-login --- src/locales/en.js | 1 + src/locales/zh_Hans.js | 1 + src/views/mobile/Unlock.vue | 17 ++++++++++------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/locales/en.js b/src/locales/en.js index 4006836a..95536fa9 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -429,6 +429,7 @@ export default { 'User has canceled or this device does not support Face ID/Touch ID': 'User has canceled or this device does not support Face ID/Touch ID', 'Failed to authenticate by Face ID/Touch ID': 'Failed to authenticate by Face ID/Touch ID', 'Face ID/Touch ID authentication is not enabled': 'Face ID/Touch ID authentication is not enabled', + 'Are you sure you want to re-login?': 'Are you sure you want to re-login?', 'Exchange Rates Data': 'Exchange Rates Data', 'Base Currency': 'Base Currency', 'Last Updated': 'Last Updated', diff --git a/src/locales/zh_Hans.js b/src/locales/zh_Hans.js index 56fcac38..82b57b67 100644 --- a/src/locales/zh_Hans.js +++ b/src/locales/zh_Hans.js @@ -429,6 +429,7 @@ export default { 'User has canceled or this device does not support Face ID/Touch ID': '用户已取消或当前设备不支持面容ID/指纹ID', 'Failed to authenticate by Face ID/Touch ID': '使用面容ID或指纹ID认证失败', 'Face ID/Touch ID authentication is not enabled': '面容ID或指纹ID认证没有启用', + 'Are you sure you want to re-login?': '您确定要重新登录?', 'Exchange Rates Data': '汇率数据', 'Base Currency': '基准货币', 'Last Updated': '最后更新', diff --git a/src/views/mobile/Unlock.vue b/src/views/mobile/Unlock.vue index 406d2f73..c3245f9d 100644 --- a/src/views/mobile/Unlock.vue +++ b/src/views/mobile/Unlock.vue @@ -108,15 +108,18 @@ export default { } }, relogin() { - const router = this.$f7router; + const self = this; + const router = self.$f7router; - this.$user.clearTokenAndUserInfo(); - this.$exchangeRates.clearExchangeRates(); - this.$settings.clearSettings(); - this.$locale.init(); + self.$confirm('Are you sure you want to re-login?', () => { + self.$user.clearTokenAndUserInfo(); + self.$exchangeRates.clearExchangeRates(); + self.$settings.clearSettings(); + self.$locale.init(); - router.navigate('/login', { - clearPreviousHistory: true + router.navigate('/login', { + clearPreviousHistory: true + }); }); } }