From 33c73a7b721ca4ddfe514c5a4f43d498e82c2683 Mon Sep 17 00:00:00 2001 From: Hendrik Wolff Date: Mon, 2 Sep 2024 13:51:29 +0200 Subject: [PATCH 1/2] 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. --- src/contentScripts/login/idp.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/contentScripts/login/idp.ts b/src/contentScripts/login/idp.ts index ccb4071..483b3a9 100644 --- a/src/contentScripts/login/idp.ts +++ b/src/contentScripts/login/idp.ts @@ -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) From 76a2f7bbf6ab71ebc2df511edad2c3e92cba37bf Mon Sep 17 00:00:00 2001 From: Hendrik Wolff Date: Mon, 2 Sep 2024 13:59:59 +0200 Subject: [PATCH 2/2] npm run test --- src/background.ts | 6 +++--- src/freshContent/settings/settingPages/AutoLogin.vue | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/background.ts b/src/background.ts index a96cb84..a438f72 100644 --- a/src/background.ts +++ b/src/background.ts @@ -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 diff --git a/src/freshContent/settings/settingPages/AutoLogin.vue b/src/freshContent/settings/settingPages/AutoLogin.vue index a33c6aa..c37b1c7 100644 --- a/src/freshContent/settings/settingPages/AutoLogin.vue +++ b/src/freshContent/settings/settingPages/AutoLogin.vue @@ -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:
MHSTKUIKTTHPQAZNVWQBJE5YQ2WACQQP
- Hier findest du mehr Informationen und eine vollständige Anleitung zur Einrichtung. + Hier findest du mehr Informationen und eine vollständige Anleitung zur Einrichtung.