Add $root.username

This commit is contained in:
Louis Lam
2022-04-19 19:40:28 +08:00
parent 17d4003e5c
commit cb55e23718
3 changed files with 16 additions and 18 deletions

View File

@@ -4,7 +4,7 @@
<!-- Change Password -->
<template v-if="!settings.disableAuth">
<p>
{{ $t("Current User") }}: <strong>{{ username }}</strong>
{{ $t("Current User") }}: <strong>{{ $root.username }}</strong>
<button v-if="! settings.disableAuth" id="logout-btn" class="btn btn-danger ms-4 me-2 mb-2" @click="$root.logout">{{ $t("Logout") }}</button>
</p>
@@ -269,7 +269,6 @@ export default {
data() {
return {
username: "",
invalidPassword: false,
password: {
currentPassword: "",
@@ -297,10 +296,6 @@ export default {
},
},
mounted() {
this.loadUsername();
},
methods: {
savePassword() {
if (this.password.newPassword !== this.password.repeatNewPassword) {
@@ -319,14 +314,6 @@ export default {
}
},
loadUsername() {
const jwtPayload = this.$root.getJWTPayload();
if (jwtPayload) {
this.username = jwtPayload.username;
}
},
disableAuth() {
this.settings.disableAuth = true;