Add complete user authentication with NextAuth.js supporting: - Email/password credentials authentication - OAuth providers (GitHub, Google) with optional configuration - JWT-based session management with 30-day expiry - Role-based access control (USER, GROWER, FARM_MANAGER, ADMIN) - Permission system with granular access control - Secure password hashing with bcrypt (12 rounds) - Rate limiting on auth endpoints - Password reset flow with secure tokens - Email verification system Files added: - lib/auth/: Core auth library (types, permissions, context, hooks, middleware) - pages/api/auth/: Auth API routes (NextAuth, register, forgot-password, verify-email) - pages/auth/: Auth pages (signin, signup, forgot-password, reset-password, verify-email) - components/auth/: Reusable auth components (LoginForm, RegisterForm, AuthGuard, etc.) Updated _app.tsx to include SessionProvider for auth state management.
39 lines
No EOL
1.1 KiB
Text
39 lines
No EOL
1.1 KiB
Text
# LocalGreenChain Environment Variables
|
|
|
|
# NextAuth.js Configuration
|
|
NEXTAUTH_URL=http://localhost:3001
|
|
NEXTAUTH_SECRET=your-secret-key-here-generate-with-openssl-rand-base64-32
|
|
|
|
# OAuth Providers (optional)
|
|
GITHUB_ID=your_github_client_id
|
|
GITHUB_SECRET=your_github_client_secret
|
|
GOOGLE_CLIENT_ID=your_google_client_id
|
|
GOOGLE_CLIENT_SECRET=your_google_client_secret
|
|
|
|
# Plants.net API (optional)
|
|
PLANTS_NET_API_KEY=your_api_key_here
|
|
|
|
# Tor Configuration
|
|
TOR_ENABLED=false
|
|
TOR_SOCKS_HOST=127.0.0.1
|
|
TOR_SOCKS_PORT=9050
|
|
TOR_CONTROL_PORT=9051
|
|
TOR_HIDDEN_SERVICE_DIR=/var/lib/tor/localgreenchain
|
|
|
|
# Privacy Settings
|
|
DEFAULT_PRIVACY_MODE=standard
|
|
ALLOW_ANONYMOUS_REGISTRATION=true
|
|
LOCATION_OBFUSCATION_DEFAULT=fuzzy
|
|
|
|
# Application Settings
|
|
NODE_ENV=development
|
|
PORT=3001
|
|
|
|
# Legacy Drupal Settings (for backward compatibility)
|
|
NEXT_PUBLIC_DRUPAL_BASE_URL=http://localhost:8080
|
|
NEXT_IMAGE_DOMAIN=localhost
|
|
DRUPAL_CLIENT_ID=52ce1a10-bf5c-4c81-8edf-eea3af95da84
|
|
DRUPAL_CLIENT_SECRET=SA9AGbHnx6pOamaAus2f9LG9XudHFjKs
|
|
DRUPAL_SITE_ID=example_marketing
|
|
DRUPAL_PREVIEW_SECRET=secret
|
|
DRUPAL_FRONT_PAGE=/home |