Security: - Replace SHA-256 password hashing with bcrypt (cost 12) + timing-safe compare - Introduce server-side session tokens (x-session-token header); drop x-user-id - Add /api/auth/logout endpoint to invalidate sessions - Enforce 8-char minimum password server-side - Fix password reset: now uses real signed tokens with 1-hour TTL Features: - Goals: savings goals with progress bars, target dates, add/withdraw funds - Auto-categorization Rules: keyword → envelope mapping applied on transaction add - Transaction search/filter: description, account, envelope, date range - Transaction table: shows envelope color dot, running balance column - Monthly Spending History chart (last 6 months income vs expenses bar chart) - Spending Insights: month-over-month comparison + overspent envelope callouts - Budget progress expanded: per-envelope bars with rollover indicator - Envelope rollover toggle: unspent funds can carry forward - Recurring transactions auto-applied on login - Save indicator in nav (Saving… / Saved ✓ / Save failed) - Nav overflow fixed: all tabs scroll horizontally instead of clipping - PWA manifest added for home-screen install support Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
771 B
TypeScript
20 lines
771 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { FileStorageService } from '@/lib/fileStorage';
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const { email, password } = await request.json();
|
|
|
|
if (!email || !password) {
|
|
return NextResponse.json({ error: 'Email and password are required' }, { status: 400 });
|
|
}
|
|
|
|
const result = await FileStorageService.registerUser(email, password);
|
|
|
|
return NextResponse.json({ success: true, user: { userId: result.userId, email: result.email }, sessionToken: result.sessionToken });
|
|
} catch (error: any) {
|
|
const status = error.message === 'User already exists' ? 409 : 400;
|
|
return NextResponse.json({ error: error.message || 'Registration failed' }, { status });
|
|
}
|
|
}
|