Fix form password

This commit is contained in:
Julien Nahum
2024-01-16 13:27:54 +01:00
parent ac82040080
commit f156f52608
3 changed files with 33 additions and 16 deletions

View File

@@ -8,10 +8,10 @@ function addAuthHeader(request, options) {
}
function addPasswordToFormRequest(request, options) {
const url = request.url
if (!url || !url.startsWith('/forms/')) return
if (!request || !request.startsWith('/forms/')) return
const slug = request.split('/')[2]
const slug = url.split('/')[3]
const passwordCookie = useCookie('password-' + slug, {maxAge: 60 * 60 * 24 * 30}) // 30 days
if (slug !== undefined && slug !== '' && passwordCookie.value !== undefined) {
options.headers['form-password'] = passwordCookie.value