diff --git a/index.html b/index.html index 1f6eaa472..62dac91cb 100644 --- a/index.html +++ b/index.html @@ -3693,7 +3693,7 @@

Artists

-
+
@@ -3703,7 +3703,7 @@

Artists

-
+
@@ -3711,7 +3711,7 @@

Artists

-
+

This can only be once a day!

diff --git a/src/Login.ts b/src/Login.ts index 5c7a7c2f2..b69fc471d 100644 --- a/src/Login.ts +++ b/src/Login.ts @@ -1,3 +1,5 @@ +/// + import i18next from 'i18next' import localforage from 'localforage' import { DOMCacheGetOrSet } from './Cache/DOM' @@ -230,18 +232,21 @@ export async function handleLogin () { subtabElement.querySelector('#register')?.style.setProperty('display', 'flex') subtabElement.querySelector('#login')?.style.setProperty('display', 'none') subtabElement.querySelector('#forgotpassword')?.style.setProperty('display', 'none') + renderCaptcha() }) subtabElement.querySelector('#open-signin')?.addEventListener('click', () => { subtabElement.querySelector('#register')?.style.setProperty('display', 'none') subtabElement.querySelector('#login')?.style.setProperty('display', 'flex') subtabElement.querySelector('#forgotpassword')?.style.setProperty('display', 'none') + renderCaptcha() }) subtabElement.querySelector('#open-forgotpassword')?.addEventListener('click', () => { subtabElement.querySelector('#register')?.style.setProperty('display', 'none') subtabElement.querySelector('#login')?.style.setProperty('display', 'none') subtabElement.querySelector('#forgotpassword')?.style.setProperty('display', 'flex') + renderCaptcha() }) } } @@ -283,3 +288,16 @@ async function getCloudSave () { await importSynergism(save?.save ?? null) } + +export function renderCaptcha () { + const captchaElements = Array.from(document.querySelectorAll('.turnstile')) + const visible = captchaElements.find((el) => el.offsetParent !== null) + + if (visible) { + turnstile.render(visible, { + sitekey: visible.getAttribute('data-sitekey')!, + 'error-callback' () {}, + retry: 'never' + }) + } +} diff --git a/src/Toggles.ts b/src/Toggles.ts index 0689b38b7..9ed543d3d 100644 --- a/src/Toggles.ts +++ b/src/Toggles.ts @@ -4,6 +4,7 @@ import { DOMCacheGetOrSet } from './Cache/DOM' import { calculateRuneLevels } from './Calculate' import { getChallengeConditions } from './Challenges' import { corruptionDisplay, corruptionLoadoutTableUpdate, maxCorruptionLevel } from './Corruptions' +import { renderCaptcha } from './Login' import { autoResearchEnabled } from './Research' import { reset, resetrepeat } from './Reset' import { format, player, resetCheck } from './Synergism' @@ -571,6 +572,8 @@ export const setActiveSettingScreen = async (subtab: string) => { const err = e as Error credits.appendChild(document.createTextNode(err.toString())) } + } else if (subtab === 'accountSubTab') { + renderCaptcha() } }