mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-22 14:05:18 -05:00
Fix setting page when disabled auth
This commit is contained in:
parent
733d0af75f
commit
95bae8289d
@ -1,5 +1,6 @@
|
|||||||
import { io } from "socket.io-client";
|
import { io } from "socket.io-client";
|
||||||
import { useToast } from "vue-toastification";
|
import { useToast } from "vue-toastification";
|
||||||
|
import jwt_decode from "jwt-decode";
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
let socket;
|
let socket;
|
||||||
@ -217,6 +218,15 @@ export default {
|
|||||||
return (this.remember) ? localStorage : sessionStorage;
|
return (this.remember) ? localStorage : sessionStorage;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getJWTPayload() {
|
||||||
|
const jwtToken = this.$root.storage().token;
|
||||||
|
|
||||||
|
if (jwtToken && jwtToken !== "autoLogin") {
|
||||||
|
return jwt_decode(jwtToken);
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
},
|
||||||
|
|
||||||
getSocket() {
|
getSocket() {
|
||||||
return socket;
|
return socket;
|
||||||
},
|
},
|
||||||
|
@ -515,9 +515,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
loadUsername() {
|
loadUsername() {
|
||||||
const jwtToken = this.$root.storage().token;
|
const jwtPayload = this.$root.getJWTPayload();
|
||||||
const jwtPayload = jwt_decode(jwtToken);
|
|
||||||
|
if (jwtPayload) {
|
||||||
this.username = jwtPayload.username;
|
this.username = jwtPayload.username;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
loadSettings() {
|
loadSettings() {
|
||||||
@ -568,6 +570,7 @@ export default {
|
|||||||
this.settings.disableAuth = false;
|
this.settings.disableAuth = false;
|
||||||
this.saveSettings();
|
this.saveSettings();
|
||||||
this.$root.storage().removeItem("token");
|
this.$root.storage().removeItem("token");
|
||||||
|
location.reload();
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadBackup() {
|
downloadBackup() {
|
||||||
|
Loading…
Reference in New Issue
Block a user