Enhance authentication flow: Add authentication-based buttons in AppNavigation for logged-in users, improve member status checks in useAuth, and update join page to automatically redirect to the dashboard after registration. Adjust cookie settings for better development experience.
This commit is contained in:
parent
2ca290d6e0
commit
600fef2b7c
11 changed files with 347 additions and 25 deletions
|
|
@ -108,10 +108,23 @@ export default defineEventHandler(async (event) => {
|
|||
email: body.email,
|
||||
helcimCustomerId: customerData.id
|
||||
},
|
||||
config.jwtSecret,
|
||||
process.env.JWT_SECRET,
|
||||
{ expiresIn: '24h' }
|
||||
)
|
||||
|
||||
// Set the session cookie server-side
|
||||
console.log('Setting auth-token cookie for member:', member.email)
|
||||
console.log('NODE_ENV:', process.env.NODE_ENV)
|
||||
setCookie(event, 'auth-token', token, {
|
||||
httpOnly: true, // Server-only for security
|
||||
secure: false, // Don't require HTTPS in development
|
||||
sameSite: 'lax',
|
||||
maxAge: 60 * 60 * 24, // 24 hours
|
||||
path: '/',
|
||||
domain: undefined // Let browser set domain automatically
|
||||
})
|
||||
console.log('Cookie set successfully')
|
||||
|
||||
return {
|
||||
success: true,
|
||||
customerId: customerData.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue