Webapp > Settings > Security: adapt changePassword call

This commit is contained in:
M1CK431 2023-08-13 23:06:31 +02:00
parent 9521b8e122
commit 27319b6ee1
2 changed files with 10 additions and 3 deletions

View file

@ -171,7 +171,7 @@ export default {
} else {
this.$root
.getSocket()
.emit("changePassword", this.password, (res) => {
.emit("changePassword", this.$root.userID, this.password, (res) => {
this.$root.toastRes(res);
if (res.ok) {
this.password.currentPassword = "";

View file

@ -33,6 +33,7 @@ export default {
connectCount: 0,
initedSocketIO: false,
},
userID: null,
username: null,
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.
@ -407,8 +408,11 @@ export default {
if (res.ok) {
this.storage().token = res.token;
this.socket.token = res.token;
const { userID, username } = this.getJWTPayload() || {};
this.userID = userID;
this.username = username;
this.loggedIn = true;
this.username = this.getJWTPayload()?.username;
// Trigger Chrome Save Password
history.pushState({}, "");
@ -430,8 +434,10 @@ export default {
if (! res.ok) {
this.logout();
} else {
const { userID, username } = this.getJWTPayload() || {};
this.userID = userID;
this.username = username;
this.loggedIn = true;
this.username = this.getJWTPayload()?.username;
}
});
},
@ -445,6 +451,7 @@ export default {
this.storage().removeItem("token");
this.socket.token = null;
this.loggedIn = false;
this.userID = null;
this.username = null;
this.clearData();
},