Skip to content

Commit

Permalink
ipd: Fix checking for totp type (#148)
Browse files Browse the repository at this point in the history
* ipd: Fix checking for totp type

The idp frontend HTML structure changed recently and broke the check for totp vs iotp.
This caused a failed totp insertion, resulting in an incomplete authentication.

* npm run test
  • Loading branch information
hw0lff authored Sep 3, 2024
1 parent 8e43d38 commit c7b7e94
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ chrome.runtime.onMessage.addListener((request, _sender, sendResponse) => {
// Asynchronous response
Promise.all([
credentials.userDataExists(request.platform),
credentials.userDataExists(request.platform + "-totp"),
credentials.userDataExists(request.platform + "-iotp")
credentials.userDataExists(request.platform + '-totp'),
credentials.userDataExists(request.platform + '-iotp')
]).then(([loginExists, totpExists, iotpExists]) => {
sendResponse(loginExists || totpExists || iotpExists)
});
})
return true // required for async sendResponse
case 'delete_user_data':
// Asynchronous response
Expand Down
4 changes: 3 additions & 1 deletion src/contentScripts/login/idp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ const cookieSettings: CookieSettings = {

const otpInput = document.getElementById('fudis_otp_input') as HTMLInputElement | null
if (otpInput) {
const indexesText = otpInput.parentElement?.parentElement?.querySelector('td:first-of-type')?.textContent?.trim()
const indexesText = otpInput.parentElement?.parentElement?.parentElement
?.querySelector('div:first-of-type')
?.textContent?.trim()
// find number & number | remove whole match | to numbers | to zero based (first index is 0)
const indexes = indexesText?.match(/(\d+) & (\d+)/)?.slice(1, 3).map((x) => Number.parseInt(x, 10) - 1)

Expand Down
5 changes: 4 additions & 1 deletion src/freshContent/settings/settingPages/AutoLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
Zwei-Faktor-Authentisierung (2FA): Das Automatische Anmelden unterstützt auch 2FA. Hier kannst du dafür deinen TOTP Secret-Key speichern.
Der Key ist Base32 enkodiert und sieht bspw. so aus: <br>
MHSTKUIKTTHPQAZNVWQBJE5YQ2WACQQP <br>
Hier findest du <a style="color:white" href="https://github.com/TUfast-TUD/TUfast_TUD/blob/main/docs/2FA.md">mehr Informationen und eine vollständige Anleitung zur Einrichtung</a>.
Hier findest du <a
style="color:white"
href="https://github.com/TUfast-TUD/TUfast_TUD/blob/main/docs/2FA.md"
>mehr Informationen und eine vollständige Anleitung zur Einrichtung</a>.
</p>
<div class="form">
<CustomInput
Expand Down

0 comments on commit c7b7e94

Please sign in to comment.