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 Aug 14, 2023
1 parent 7b4f98d commit a42959d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/settings/Security.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,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
6 changes: 5 additions & 1 deletion src/mixins/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 @@ -371,10 +372,13 @@ export default {
}

if (res.ok) {
const { userID, username } = this.getJWTPayload() || {};
this.userID = userID;
this.username = username;

this.storage().token = res.token;
this.socket.token = res.token;
this.loggedIn = true;
this.username = this.getJWTPayload()?.username;

// Trigger Chrome Save Password
history.pushState({}, "");
Expand Down

0 comments on commit a42959d

Please sign in to comment.