From 07dbc3adf31ac35aa90b935b41cdf0b944cc5928 Mon Sep 17 00:00:00 2001 From: Julien Nahum Date: Tue, 16 Jan 2024 18:27:58 +0100 Subject: [PATCH] Fix form password + remove branding --- app/Http/Resources/FormResource.php | 1 + client/pages/forms/[slug]/index.vue | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/Http/Resources/FormResource.php b/app/Http/Resources/FormResource.php index f75942a..5a07aaa 100644 --- a/app/Http/Resources/FormResource.php +++ b/app/Http/Resources/FormResource.php @@ -85,6 +85,7 @@ class FormResource extends JsonResource 'is_password_protected' => true, 'has_password' => $this->has_password, 'width' => 'centered', + 'no_branding' => $this->no_branding, 'properties' => [] ]; } diff --git a/client/pages/forms/[slug]/index.vue b/client/pages/forms/[slug]/index.vue index 11b0452..c6f5ecf 100644 --- a/client/pages/forms/[slug]/index.vue +++ b/client/pages/forms/[slug]/index.vue @@ -75,15 +75,20 @@ onBeforeRouteLeave((to, from) => { }) const passwordEntered = function (password) { - useCookie('password-' + slug, { + const cookie = useCookie('password-' + slug, { maxAge: 60 * 60 * 7, sameSite: false, secure: true - }).value = sha256(password) - loadForm().then(() => { - if (form.value?.is_password_protected) { - openCompleteForm.value.addPasswordError('Invalid password.') - } + }) + cookie.value = sha256(password) + nextTick(() => { + console.log('cookie value:',cookie.value) + loadForm().then(() => { + if (form.value?.is_password_protected) { + openCompleteForm.value.addPasswordError('Invalid password.') + } + }) + openCompleteForm.value.submit() }) } @@ -121,7 +126,6 @@ const loadForm = async (setup=false) => { } onMounted(() => { - loadForm() if (form.value) { handleDarkMode(form.value?.dark_mode) handleTransparentMode(form.value?.transparent_background)