mirror of
https://github.com/taogaetz/chefbible.git
synced 2025-12-06 11:47:24 -05:00
update cookies to work on mobile safari
This commit is contained in:
parent
0561d6cda5
commit
71ac76bc72
@ -2,6 +2,7 @@ import type { PageServerLoad } from './$types';
|
|||||||
import { validateMagicLinkToken } from '$lib/auth';
|
import { validateMagicLinkToken } from '$lib/auth';
|
||||||
import { redirect } from '@sveltejs/kit';
|
import { redirect } from '@sveltejs/kit';
|
||||||
import { MAGIC_LINK_TOKEN } from '$env/static/private';
|
import { MAGIC_LINK_TOKEN } from '$env/static/private';
|
||||||
|
import { dev } from '$app/environment';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ url, cookies }) => {
|
export const load: PageServerLoad = async ({ url, cookies }) => {
|
||||||
const token = url.searchParams.get('token');
|
const token = url.searchParams.get('token');
|
||||||
@ -21,7 +22,8 @@ export const load: PageServerLoad = async ({ url, cookies }) => {
|
|||||||
cookies.set('chef_bible_auth', 'authenticated', {
|
cookies.set('chef_bible_auth', 'authenticated', {
|
||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'strict',
|
sameSite: 'lax', // Changed from 'strict' to 'lax' for mobile Safari compatibility
|
||||||
|
secure: !dev, // Secure in production, not secure in development
|
||||||
maxAge: 30 * 24 * 60 * 60 // 30 days in seconds
|
maxAge: 30 * 24 * 60 * 60 // 30 days in seconds
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from './$types';
|
||||||
import { redirect } from '@sveltejs/kit';
|
import { redirect } from '@sveltejs/kit';
|
||||||
|
import { dev } from '$app/environment';
|
||||||
|
|
||||||
export const POST: RequestHandler = async ({ cookies }) => {
|
export const POST: RequestHandler = async ({ cookies }) => {
|
||||||
// Clear the authentication cookie using the new API
|
// Clear the authentication cookie using the new API
|
||||||
cookies.set('chef_bible_auth', '', {
|
cookies.set('chef_bible_auth', '', {
|
||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'strict',
|
sameSite: 'lax', // Changed from 'strict' to 'lax' for mobile Safari compatibility
|
||||||
|
secure: !dev, // Secure in production, not secure in development
|
||||||
maxAge: 0 // Expire immediately
|
maxAge: 0 // Expire immediately
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -19,7 +21,8 @@ export const GET: RequestHandler = async ({ cookies }) => {
|
|||||||
cookies.set('chef_bible_auth', '', {
|
cookies.set('chef_bible_auth', '', {
|
||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'strict',
|
sameSite: 'lax', // Changed from 'strict' to 'lax' for mobile Safari compatibility
|
||||||
|
secure: !dev, // Secure in production, not secure in development
|
||||||
maxAge: 0 // Expire immediately
|
maxAge: 0 // Expire immediately
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user