Skip to content

Commit

Permalink
Webapp > Settings > Security: adapt changePassword call
Browse files Browse the repository at this point in the history
  • Loading branch information
M1CK431 committed Oct 15, 2024
1 parent 9521b8e commit 27319b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/settings/Security.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down
11 changes: 9 additions & 2 deletions src/mixins/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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({}, "");
Expand All @@ -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;
}
});
},
Expand All @@ -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();
},
Expand Down

0 comments on commit 27319b6

Please sign in to comment.