fix/missing-functionalities
into master
4 years ago
@@ -66,7 +66,11 @@ export default { | |||
this.currentUser.locale !== null | |||
? this.currentUser.locale | |||
: 'detect'; | |||
if (this.currentUser && !this.currentUser.admin) { | |||
if ( | |||
this.currentUser && | |||
!this.currentUser.admin && | |||
!this.verifiedContacts | |||
) { | |||
this.getPolicyByUserId({ | |||
userId: this.currentUser.uuid, | |||
messages: this.messages, | |||
@@ -76,6 +80,7 @@ export default { | |||
this.isPageAvailable = | |||
!this.currentUser || | |||
this.$route.path === '/login' || | |||
this.$route.path === '/me/action' || | |||
this.$route.path === '/logout' || | |||
this.$route.path === '/verifyEmail' || | |||
@@ -106,6 +111,8 @@ export default { | |||
navigateToPaymentPage() { | |||
if (this.$route.path !== '/payment') { | |||
this.$router.push('/payment'); | |||
} else { | |||
this.initDefaults(); | |||
} | |||
}, | |||
@@ -277,8 +277,15 @@ export default { | |||
priceMinorUnits: this.plans[i].price % 100, | |||
}); | |||
} | |||
const matchingPlan = this.plans.find( | |||
(plan) => plan.uuid === this.user.preferredPlan | |||
); | |||
if (matchingPlan) { | |||
this.bubblePlan = matchingPlan.name; | |||
} else { | |||
this.bubblePlan = this.plans[0].name; | |||
} | |||
} | |||
return plans_array; | |||
}, | |||
}, | |||
@@ -938,9 +938,7 @@ | |||
<Checkbox | |||
id="receiveLoginNotifications" | |||
v-model="newContact.receiveLoginNotifications" | |||
:label=" | |||
messages.field_label_policy_contact_receiveLoginNotifications | |||
" | |||
:label="messages.field_label_policy_contact_receiveLoginNotifications" | |||
/> | |||
</div> | |||
<div | |||
@@ -1008,6 +1006,52 @@ | |||
<img v-show="loading()" :src="loadingImgSrc" /> | |||
</div> | |||
</form> | |||
<hr /> | |||
<form | |||
@submit.prevent="updateProfile" | |||
v-if="configs.showBlockStatsSupported || currentUser.admin === true" | |||
> | |||
<div v-if="configs.showBlockStatsSupported" class="form-group"> | |||
<Checkbox | |||
id="showBlockStats" | |||
v-model="profile.showBlockStats" | |||
:label="messages.field_label_show_block_stats" | |||
/> | |||
<div | |||
v-if="submitted && errors.has('showBlockStats')" | |||
class="invalid-feedback d-block" | |||
> | |||
{{ errors.first('showBlockStats') }} | |||
</div> | |||
</div> | |||
<!-- sync password --> | |||
<div v-if="currentUser.admin === true" class="form-group"> | |||
<Checkbox | |||
id="sync" | |||
v-model="profile.sync" | |||
:label="messages.field_label_sync_account" | |||
/> | |||
<div | |||
v-if="submitted && errors.has('sync')" | |||
class="invalid-feedback d-block" | |||
> | |||
{{ errors.first('sync') }} | |||
</div> | |||
<p>{{ messages.field_label_sync_account_description }}</p> | |||
</div> | |||
<div class="form-group"> | |||
<Button | |||
color="default" | |||
type="submit" | |||
class="btn btn-primary" | |||
:disabled="loading()" | |||
> | |||
{{ messages.button_label_update_policy }} | |||
</Button> | |||
<img v-show="loading()" :src="loadingImgSrc" /> | |||
</div> | |||
</form> | |||
</div> | |||
</template> | |||
@@ -1082,11 +1126,18 @@ export default { | |||
watchedPolicy: null, | |||
showDownloadMessages: false, | |||
loadingImgSrc: loadingImgSrc, | |||
profile: { | |||
email: null, | |||
sync: null, | |||
showBlockStats: null, | |||
}, | |||
}; | |||
}, | |||
computed: { | |||
...mapState('account', ['actionStatus', 'status']), | |||
...mapState('system', [ | |||
'configs', | |||
'messages', | |||
'accountDeletionOptions', | |||
'timeDurationOptions', | |||
@@ -1140,6 +1191,7 @@ export default { | |||
]), | |||
...mapActions('users', [ | |||
'getUserById', | |||
'updateUser', | |||
'getPolicyByUserId', | |||
'updatePolicyByUserId', | |||
'addPolicyContactByUserId', | |||
@@ -1176,6 +1228,15 @@ export default { | |||
errors: this.errors, | |||
}); | |||
}, | |||
updateProfile() { | |||
this.errors.clear(); | |||
this.submitted = true; | |||
this.updateUser({ | |||
user: this.profile, | |||
messages: this.messages, | |||
errors: this.errors, | |||
}); | |||
}, | |||
addContact(e) { | |||
const contactToAdd = Object.assign({}, this.newContact); | |||
if (contactToAdd.type === 'sms') { | |||
@@ -1456,6 +1517,10 @@ export default { | |||
errors: this.errors, | |||
}); | |||
} | |||
this.profile.email = this.currentUser.email; | |||
this.profile.showBlockStats = this.currentUser.showBlockStats; | |||
this.profile.sync = this.currentUser.sync; | |||
}, | |||
}; | |||
</script> |
@@ -336,6 +336,35 @@ | |||
</div> | |||
</div> | |||
<form @submit.prevent="updateProfile"> | |||
<h3>{{ messages.field_label_auto_update_policy }}</h3> | |||
<Checkbox | |||
v-if="user.admin" | |||
class="mb-3" | |||
id="autoUpdatePolicy.jarUpdates" | |||
v-model="autoUpdatePolicy.jarUpdates" | |||
:label="messages.field_label_auto_update_jar" | |||
/> | |||
<Checkbox | |||
id="autoUpdatePolicy.appUpdates" | |||
class="mb-3" | |||
v-model="autoUpdatePolicy.appUpdates" | |||
:label="messages.field_label_auto_update_apps" | |||
/> | |||
<div class="form-group"> | |||
<Button | |||
color="default" | |||
type="submit" | |||
class="btn btn-primary" | |||
:disabled="loadingUser()" | |||
> | |||
{{ messages.button_label_update_policy }} | |||
</Button> | |||
<img v-show="loadingUser()" :src="loadingImgSrc" /> | |||
</div> | |||
</form> | |||
<div v-if="configs.sageLauncher"> | |||
<div class="text-danger"> | |||
<h4>{{ messages.title_network_danger_zone }}</h4> | |||
@@ -408,12 +437,13 @@ import { mapState, mapActions, mapGetters } from 'vuex'; | |||
import { util } from '~/_helpers'; | |||
import { loadingImgSrc } from '~/_store'; | |||
import { Button, Input } from '~/_components/shared'; | |||
import { Button, Input, Checkbox } from '~/_components/shared'; | |||
export default { | |||
components: { | |||
Button, | |||
Input, | |||
Checkbox, | |||
}, | |||
data() { | |||
return { | |||
@@ -431,6 +461,10 @@ export default { | |||
upgradeRefresher: null, | |||
logsExpirationDays: null, | |||
backupDownloadRefresher: null, | |||
autoUpdatePolicy: { | |||
jarUpdates: true, | |||
appUpdates: true, | |||
}, | |||
lottie: null, | |||
timerID: null, | |||
@@ -588,6 +622,9 @@ export default { | |||
'checkForUpgrade', | |||
'upgrade', | |||
]), | |||
...mapActions('users', ['updateUser']), | |||
...mapGetters('users', { loadingUser: 'loading' }), | |||
refreshStatus(userId) { | |||
if (!this.lottie && this.$refs.lottie) { | |||
this.lottie = Lottie.loadAnimation({ | |||
@@ -785,6 +822,18 @@ export default { | |||
doUpgrade() { | |||
this.upgrade(); | |||
}, | |||
updateProfile() { | |||
this.errors.clear(); | |||
this.submitted = true; | |||
this.updateUser({ | |||
user: { | |||
email: this.user.email, | |||
autoUpdatePolicy: this.autoUpdatePolicy, | |||
}, | |||
messages: this.messages, | |||
errors: this.errors, | |||
}); | |||
}, | |||
}, | |||
created() { | |||
@@ -794,6 +843,8 @@ export default { | |||
this.restoreKeyCode = this.$route.query.keys_code; | |||
this.getAppLinks(user.locale); | |||
this.loadSystemConfigs(); | |||
this.autoUpdatePolicy = user.autoUpdatePolicy; | |||
}, | |||
beforeDestroy() { | |||
@@ -56,7 +56,7 @@ export const router = new Router({ | |||
// { path: '/legal', component: LegalPage }, | |||
// { path: '/support', component: SupportPage }, | |||
// { path: '/me/old', component: ProfilePage }, | |||
{ path: '/me/old', component: ProfilePage }, | |||
// { path: '/me/policy', component: PolicyPage }, | |||
// { path: '/me/changePassword/old', component: ChangePasswordPage }, | |||
// { path: '/me/setPassword/:code', component: SetPasswordPage }, | |||