@@ -33,6 +33,7 @@ export default { | |||
sendMetrics: true, | |||
}, | |||
payMethods: null, | |||
hasPaymentMethod: false, | |||
}), | |||
computed: { | |||
@@ -42,7 +43,14 @@ export default { | |||
isPageAvailable() { | |||
return ( | |||
!this.currentUser || (this.verifiedContacts || this.currentUser.admin) | |||
!this.currentUser || | |||
((this.verifiedContacts || | |||
this.currentUser.admin || | |||
this.$route.path === '/verifyEmail' || | |||
this.$route.path === '/me/action') && | |||
(!this.configs.paymentsEnabled || | |||
this.hasPaymentMethod === true || | |||
this.$route.path === '/payment')) | |||
); | |||
}, | |||
}, | |||
@@ -162,6 +170,7 @@ export default { | |||
this.accountPlan.paymentMethodObject.uuid === null && | |||
payMethods.length > 0 | |||
) { | |||
this.hasPaymentMethod = true; | |||
this.navigateToDashboard(); | |||
} else { | |||
this.navigateToPaymentPage(); | |||
@@ -1,13 +1,13 @@ | |||
<!-- Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ --> | |||
<template> | |||
<div class="container-fluid" v-if="isPageAvailable"> | |||
<div class="container-fluid"> | |||
<img src="/bubble_bkgrnd.png" alt="" class="background-image" /> | |||
<div class="content"> | |||
<Sidebar /> | |||
<div class="flex-grow-1 p-4"> | |||
<header> | |||
<!-- <p class="mb-0">{{ messages.label_homepage_welcome }},</p>--> | |||
<!-- <p class="name">{{ currentUser.name }} 👋</p>--> | |||
<!-- <p class="mb-0">{{ messages.label_homepage_welcome }},</p>--> | |||
<!-- <p class="name">{{ currentUser.name }} 👋</p>--> | |||
</header> | |||
<main> | |||
<router-view></router-view> | |||
@@ -91,47 +91,18 @@ export default { | |||
data: () => ({ | |||
currentUser: null, | |||
hasPaymentMethod: false, | |||
}), | |||
computed: { | |||
...mapState('system', ['configs', 'messages']), | |||
isPageAvailable() { | |||
return !this.configs.paymentsEnabled || this.hasPaymentMethod; | |||
}, | |||
}, | |||
created() { | |||
this.currentUser = util.currentUser(); | |||
}, | |||
mounted() { | |||
if (this.configs.paymentsEnabled) { | |||
this.hasPaymentMethod = true; | |||
} | |||
if (this.accountPaymentMethods && this.configs.paymentsEnabled) { | |||
const payMethods = []; | |||
Array.from(this.accountPaymentMethods).forEach((pm) => { | |||
if ( | |||
(typeof pm.promotion === 'undefined' || | |||
pm.promotion === null || | |||
!pm.promotion) && | |||
(typeof pm.deleted === 'undefined' || pm.deleted === null) | |||
) { | |||
payMethods.push(pm); | |||
} | |||
}); | |||
if (payMethods.length > 0) { | |||
this.hasPaymentMethod = true; | |||
} | |||
} | |||
}, | |||
mounted() {}, | |||
methods: { | |||
...mapActions('paymentMethods', ['getAllAccountPaymentMethods']), | |||
...mapState('paymentMethods', ['accountPaymentMethods']), | |||
}, | |||
methods: {}, | |||
}; | |||
</script> |
@@ -102,9 +102,7 @@ export default { | |||
watch: { | |||
networks(nets) { | |||
if (nets && nets.length) { | |||
if (nets.length === 0) { | |||
this.$router.replace({ path: '/new_bubble' }); | |||
} else if (nets.length === 1 && util.currentUser().admin !== true) { | |||
if (nets.length === 1 && util.currentUser().admin !== true) { | |||
this.$router.replace({ path: '/bubble/' + nets[0].name }); | |||
} | |||
} | |||
@@ -219,37 +219,6 @@ export const router = new Router({ | |||
{ path: 'logout', component: () => import('~/auth/LogoutPage') }, | |||
], | |||
}, | |||
{ | |||
path: '', | |||
component: () => import('~/_pages/auth/Layout'), | |||
children: [ | |||
{ | |||
path: 'login', | |||
component: () => import('~/_pages/auth/Login'), | |||
}, | |||
{ | |||
path: 'forgotPassword', | |||
component: () => import('~/_pages/auth/ForgotPassword'), | |||
}, | |||
{ | |||
path: 'register', | |||
component: () => import('~/_pages/auth/Register'), | |||
}, | |||
{ | |||
path: 'appLogin', | |||
component: () => import('~/_pages/auth/AppLogin'), | |||
}, | |||
{ | |||
path: 'verifyEmail', | |||
component: () => import('~/_pages/auth/VerifyEmail'), | |||
}, | |||
{ | |||
path: 'payment', | |||
component: () => import('~/_pages/auth/Payment'), | |||
}, | |||
{ path: 'logout', component: () => import('~/auth/LogoutPage') }, | |||
], | |||
}, | |||
], | |||
}, | |||
@@ -164,11 +164,17 @@ const actions = { | |||
(error) => commit('restoreFailure', systemConfigs, error) | |||
); | |||
}, | |||
restoreFromPackage({ commit }, { shortKey, backupFileRef, password, systemConfigs, messages, errors }) { | |||
restoreFromPackage( | |||
{ commit }, | |||
{ shortKey, backupFileRef, password, systemConfigs, messages, errors } | |||
) { | |||
commit('restoreRequest', systemConfigs); | |||
userService.restoreFromPackage(shortKey, backupFileRef, password, messages, errors) | |||
.then(ok => commit('restoreSuccess', systemConfigs), | |||
error => commit('restoreFailure', systemConfigs, error)); | |||
userService | |||
.restoreFromPackage(shortKey, backupFileRef, password, messages, errors) | |||
.then( | |||
(ok) => commit('restoreSuccess', systemConfigs), | |||
(error) => commit('restoreFailure', systemConfigs, error) | |||
); | |||
}, | |||
forgotPassword({ commit }, { username, messages, errors }) { | |||
commit('forgotPasswordRequest'); | |||
@@ -187,7 +193,7 @@ const actions = { | |||
userService.register(user, messages, errors).then( | |||
(user) => { | |||
commit('registerSuccess', user); | |||
router.push('/new_bubble'); | |||
router.push('/bubble'); | |||
setTimeout(() => { | |||
// display success message after route change completes | |||
dispatch('alert/success', messages.alert_registration_success, { | |||
@@ -315,7 +321,11 @@ const mutations = { | |||
}, | |||
checkSessionRequest(state) {}, | |||
checkSessionSuccess(state, user) { | |||
console.log('checkSessionSuccess', state.user.preferredPlan, user.preferredPlan); | |||
console.log( | |||
'checkSessionSuccess', | |||
state.user.preferredPlan, | |||
user.preferredPlan | |||
); | |||
if (user.token) { | |||
if (util.currentUser() === null) { | |||
// we must have logged out while this request was in flight... do nothing | |||
@@ -410,15 +420,21 @@ const mutations = { | |||
}, | |||
restoreRequest(state, systemConfigs) { | |||
state.status = Object.assign({}, state.status, { uploadingRestoreRequestData: true }); | |||
state.status = Object.assign({}, state.status, { | |||
uploadingRestoreRequestData: true, | |||
}); | |||
}, | |||
restoreSuccess(state, systemConfigs) { | |||
state.status = Object.assign({}, state.status, { uploadingRestoreRequestData: false }); | |||
state.status = Object.assign({}, state.status, { | |||
uploadingRestoreRequestData: false, | |||
}); | |||
systemConfigs.restoreInProgress = true; | |||
systemConfigs.awaitingRestore = false; | |||
}, | |||
restoreFailure(state, systemConfigs, error) { | |||
state.status = Object.assign({}, state.status, { uploadingRestoreRequestData: false }); | |||
state.status = Object.assign({}, state.status, { | |||
uploadingRestoreRequestData: false, | |||
}); | |||
systemConfigs.restoreInProgress = false; | |||
console.log('restore failed: ' + JSON.stringify(error)); | |||
}, | |||