Skip to content

Commit

Permalink
fix: correct 2fa page detection
Browse files Browse the repository at this point in the history
Ran into an issue due to slight differences between versions and features
of Neptun at different educational institutes.
The previous detection only worked if the 2fa tab was the first in the
settings list at the page load.
We don't really need the tab to be visible in order to modify it,
so the active tab restriction is removed.
  • Loading branch information
MrExplode committed May 31, 2024
1 parent 111d550 commit 473f722
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ export function writeToken(token: string) {
}

/**
* @returns true when the current page is the 2fa settings
* @returns true when the 2fa settings are available in the DOM.
* The active tab may NOT be the 2fa, but this does not prevent the injection of our stuff.
*/
export function is2faPage(): boolean {
const tab = $('#c_options_ctl02_tab')
return tab.length != 0 && tab.hasClass('ajax__tab_active')
return tab.length != 0
}

/**
Expand Down

0 comments on commit 473f722

Please sign in to comment.