mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-03 16:05:56 +00:00
Webapp > Settings > Security: adapt changePassword call
This commit is contained in:
parent
9521b8e122
commit
27319b6ee1
2 changed files with 10 additions and 3 deletions
|
@ -171,7 +171,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$root
|
this.$root
|
||||||
.getSocket()
|
.getSocket()
|
||||||
.emit("changePassword", this.password, (res) => {
|
.emit("changePassword", this.$root.userID, this.password, (res) => {
|
||||||
this.$root.toastRes(res);
|
this.$root.toastRes(res);
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
this.password.currentPassword = "";
|
this.password.currentPassword = "";
|
||||||
|
|
|
@ -33,6 +33,7 @@ export default {
|
||||||
connectCount: 0,
|
connectCount: 0,
|
||||||
initedSocketIO: false,
|
initedSocketIO: false,
|
||||||
},
|
},
|
||||||
|
userID: null,
|
||||||
username: null,
|
username: null,
|
||||||
remember: (localStorage.remember !== "0"),
|
remember: (localStorage.remember !== "0"),
|
||||||
allowLoginDialog: false, // Allowed to show login dialog, but "loggedIn" have to be true too. This exists because prevent the login dialog show 0.1s in first before the socket server auth-ed.
|
allowLoginDialog: false, // Allowed to show login dialog, but "loggedIn" have to be true too. This exists because prevent the login dialog show 0.1s in first before the socket server auth-ed.
|
||||||
|
@ -407,8 +408,11 @@ export default {
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
this.storage().token = res.token;
|
this.storage().token = res.token;
|
||||||
this.socket.token = res.token;
|
this.socket.token = res.token;
|
||||||
|
|
||||||
|
const { userID, username } = this.getJWTPayload() || {};
|
||||||
|
this.userID = userID;
|
||||||
|
this.username = username;
|
||||||
this.loggedIn = true;
|
this.loggedIn = true;
|
||||||
this.username = this.getJWTPayload()?.username;
|
|
||||||
|
|
||||||
// Trigger Chrome Save Password
|
// Trigger Chrome Save Password
|
||||||
history.pushState({}, "");
|
history.pushState({}, "");
|
||||||
|
@ -430,8 +434,10 @@ export default {
|
||||||
if (! res.ok) {
|
if (! res.ok) {
|
||||||
this.logout();
|
this.logout();
|
||||||
} else {
|
} else {
|
||||||
|
const { userID, username } = this.getJWTPayload() || {};
|
||||||
|
this.userID = userID;
|
||||||
|
this.username = username;
|
||||||
this.loggedIn = true;
|
this.loggedIn = true;
|
||||||
this.username = this.getJWTPayload()?.username;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -445,6 +451,7 @@ export default {
|
||||||
this.storage().removeItem("token");
|
this.storage().removeItem("token");
|
||||||
this.socket.token = null;
|
this.socket.token = null;
|
||||||
this.loggedIn = false;
|
this.loggedIn = false;
|
||||||
|
this.userID = null;
|
||||||
this.username = null;
|
this.username = null;
|
||||||
this.clearData();
|
this.clearData();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue