Improve handling of expired password
This commit is contained in:
@@ -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) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user