Skip to content

Commit 897d945

Browse files
committed
Update index.html
1 parent bfd7f6b commit 897d945

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

.github/pages/login_info/index.html

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,30 @@
2626
const redirectUrl = urlParams.get('redirect')
2727
const fileId = urlParams.get('fileId')
2828
const from = urlParams.get('from')
29+
const errorModal = document.getElementById('error_modal')
30+
const errorMessageElement = document.getElementById('error_modal_message')
31+
const ignoreBtn = document.getElementById('ignore_and_continue_btn')
2932

3033
try {
31-
const encryptedData = await receiveAndValidateEncryptedCredentials(fileId, from, hashParams, uuid)
3234
const instanceId = uuid.split('-')[0]
33-
if (encryptedData) { // save
35+
if (fileId || from) try { // save
36+
const encryptedData = await receiveAndValidateEncryptedCredentials(fileId, from, hashParams, uuid)
3437
localStorage.setItem(`fount-login-${instanceId}`, encryptedData)
3538
window.location.href = decodeURIComponent(redirectUrl)
39+
} catch (error) {
40+
console.error('Failed to receive credentials:', error)
41+
errorMessageElement.textContent = `An error occurred while trying to retrieve your login credentials: ${error.message}\nYou can continue without logging in.`
42+
throw error
3643
}
37-
else // load
44+
else try {// load
3845
await transferEncryptedCredentials(uuid, redirectUrl)
46+
} catch (error) {
47+
console.error('Failed to transfer credentials:', error)
48+
errorMessageElement.textContent = `An error occurred while trying to transfer your login credentials: ${error.message}\nYou can continue without login info.`
49+
throw error
50+
}
3951
}
4052
catch (error) {
41-
console.error('Failed to receive credentials:', error)
42-
const errorModal = document.getElementById('error_modal')
43-
const errorMessageElement = document.getElementById('error_modal_message')
44-
const ignoreBtn = document.getElementById('ignore_and_continue_btn')
45-
46-
errorMessageElement.textContent = `An error occurred while trying to retrieve your login credentials: ${error.message}. You can continue without logging in.`
4753
errorModal.showModal()
4854

4955
ignoreBtn.onclick = () => {

0 commit comments

Comments
 (0)