diff --git a/app/src/index.ts b/app/src/index.ts index 56673b3..ca4d53e 100644 --- a/app/src/index.ts +++ b/app/src/index.ts @@ -40,11 +40,6 @@ const checkPassword = (req: Request, res: Response, next: NextFunction) => { })) if (payload?.expires && dayjs(payload.expires) > dayjs()) { req.password = payload.password - } else { - log(`Attempted to load assets from ${req.params.key} with an expired decryption token`) - // Send 404 rather than 401 so as not to provide information to an attacker that there is "something" at this path - res.status(404).send() - return } } catch (e) { } } diff --git a/app/views/password.ejs b/app/views/password.ejs index f59aa4e..8d32c04 100644 --- a/app/views/password.ejs +++ b/app/views/password.ejs @@ -45,14 +45,16 @@ async function submitForm (formElement) { const formData = new FormData(formElement) try { + // Validate password const res = await fetch('/share/unlock', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(Object.fromEntries(formData.entries())) }) if (res.status === 200) { + // Valid password - redirect to the gallery const params = await res.json() - window.location = window.location + '?' + new URLSearchParams(params).toString() + window.location = window.location.href.split('?')[0] + '?' + new URLSearchParams(params).toString() } } catch (e) { } }