Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/app/api/auth/otp/verify/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ export async function POST(req: Request) {
user: result.user,
});

const isProd = process.env.NODE_ENV === 'production';
const host = req.headers.get('host') || '';
const isLocal = host.includes('localhost') || host.includes('127.0.0.1');
const isSecure = process.env.NODE_ENV === 'production' && !isLocal;

// Set secure HTTP-only session cookie for 30 days
response.cookies.set('apex_session_token', result.token, {
httpOnly: true,
secure: isProd,
secure: isSecure,
sameSite: 'lax',
path: '/',
maxAge: 30 * 24 * 60 * 60, // 30 days
Expand All @@ -48,7 +50,7 @@ export async function POST(req: Request) {
// Also set finance_user_id for profile routing
response.cookies.set('finance_user_id', result.user.id, {
httpOnly: true,
secure: isProd,
secure: isSecure,
sameSite: 'lax',
path: '/',
maxAge: 30 * 24 * 60 * 60,
Expand Down
2 changes: 1 addition & 1 deletion src/app/reports/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ export default function ReportsPage({
const savingsRate = totalMonthIncome > 0 ? Math.round(((totalMonthIncome - totalMonthSpend) / totalMonthIncome) * 100) : 0;

// Active analytics data based on view mode
const totalTaggedSpend = useMemo(() => spendingByTag.reduce((acc: number, t: any) => acc + (t.total || 0), 0), [spendingByTag]);
const totalTaggedSpend = spendingByTag.reduce((acc: number, t: any) => acc + (t.total || 0), 0);
const activeAnalytics = analyticsView === 'category' ? spendingByCategory : spendingByTag;
const activeAnalyticsTotal = analyticsView === 'category' ? totalMonthSpend : totalTaggedSpend;
const analyticsLabel = analyticsView === 'category' ? 'Category' : 'Tag';
Expand Down
Loading
Loading