Skip to content

Commit

Permalink
fix(core): new account temp password modal closing
Browse files Browse the repository at this point in the history
The modal should move to the next tab if temp password, but due to a
race condition in the session revalidation logic (rechecking all socket
sessions) before the new pw hash was added to the cookie session store
it was causing the socket to revalidate, changing react's AuthData which
means that the password was not temporary anymore therefore the save
button on the modal was just "save and close" instead of changing to the
next (identifiers) tab.
  • Loading branch information
tabarra committed Feb 13, 2024
1 parent 6062fbe commit c879c03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions core/components/AdminVault/index.js
Expand Up @@ -398,8 +398,13 @@ export default class AdminVault {
}
if (typeof permissions !== 'undefined') this.admins[adminIndex].permissions = permissions;

//Prevent race condition, will allow the session to be updated before refreshing socket.io
//sessions which will cause reauth and closing of the temp password modal on first access
setTimeout(() => {
this.refreshOnlineAdmins().catch((e) => { });
}, 250);

//Saving admin file
this.refreshOnlineAdmins().catch((e) => { });
try {
await this.writeAdminsFile();
return (password !== null) ? this.admins[adminIndex].password_hash : true;
Expand Down Expand Up @@ -549,7 +554,8 @@ export default class AdminVault {
}

this.admins = jsonData;
this.refreshOnlineAdmins().catch((e) => { });
//NOTE: since this runs only at the start, nobody is online yet
// this.refreshOnlineAdmins().catch((e) => { });
if (migrated) {
try {
await this.writeAdminsFile();
Expand Down
2 changes: 1 addition & 1 deletion docs/dev_notes.md
Expand Up @@ -4,6 +4,7 @@
- [x] reduce bodyparser limit - double check
- [x] fix the timer issue that keeps requests in memory for longer than needed
- [x] implement rps/heap watcher
- [x] fix issue where the forced password change on save reloads the page instead of moving to the identifiers tab
- [ ] merge prs
- [ ] feat(menu): add keymapping for tp to waypoint (PR #886)
- [ ] fix(nui/PlayerModel): require OneSync for bring and goto (PR #851)
Expand All @@ -22,7 +23,6 @@ seems like it just refreshes the page
- live console bookmarks

- [ ] build: generate fxmanifest files list dynamically
- [ ] fix issue where the forced password change on save reloads the page instead of moving to the identifiers tab
- [ ] easter egg with some old music? https://www.youtube.com/watch?v=nNoaXej0Jeg
- [ ] update docs on development?

Expand Down

0 comments on commit c879c03

Please sign in to comment.