mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 16:15:25 +08:00
use jwt
This commit is contained in:
@@ -487,9 +487,11 @@ export default {
|
||||
},
|
||||
|
||||
loadUsername() {
|
||||
this.$root.getSocket().emit("getUsername", (res) => {
|
||||
this.username = res.data;
|
||||
});
|
||||
const jwtToken = localStorage.getItem("token");
|
||||
const [match, headerBase64, payloadBase64, signatureBase64] = jwtToken.match(/^(\S+)\.(\S+)\.(\S+)$/i);
|
||||
const payload = atob(payloadBase64);
|
||||
const oPayload = JSON.parse(payload);
|
||||
this.username = oPayload.username;
|
||||
},
|
||||
|
||||
loadSettings() {
|
||||
|
Reference in New Issue
Block a user