feat: fix registration 500, add forgot-password flow, frontend validation
Some checks failed
Build and Deploy / Backend Tests (push) Has been cancelled
Build and Deploy / Frontend Build Check (push) Has been cancelled
Build and Deploy / Build Docker Images (push) Has been cancelled
Build and Deploy / Deploy to Server (push) Has been cancelled

- Fix MissingGreenlet: sync_engine now uses psycopg2 instead of asyncpg
- Fix bcrypt/passlib compat: pin bcrypt<4.1 in requirements
- Fix legacy password_hash NOT NULL: alter column to nullable in migration
- Add frontend password validation (uppercase + lowercase + digit)
- Add forgot-password and reset-password backend endpoints
- Add forgot-password and reset-password frontend pages
- Add email_service.py (SMTP via admin settings)
- Add reset_token/reset_token_expires columns to User model
- Migrate legacy JSON-only users to DB on password reset request
- Mount data/ volume in docker-compose.local.yml for persistence
- Add production deployment config (Dockerfile, nginx, deploy.sh)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Sepehr Ramezani
2026-05-01 16:23:51 +02:00
parent 26bd096a06
commit 2f7347b4db
25 changed files with 2765 additions and 64 deletions

View File

@@ -1,49 +1,55 @@
# Document Translation Frontend - Dockerfile
# Office Translator - Frontend Dockerfile
# Multi-stage build for optimized production
# Build stage
# ---- Build stage ----
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
# Copy package files first (better layer caching)
COPY frontend/package*.json ./
# Install dependencies
RUN npm ci --only=production=false
# Install ALL dependencies (dev needed for build)
RUN npm install
# Copy source code
COPY frontend/ .
# Build arguments for environment
ARG NEXT_PUBLIC_API_URL=http://localhost:8000
# Build arguments
# NEXT_PUBLIC_API_URL: client-side API base (empty = relative URLs via proxy)
# BACKEND_URL: server-side proxy target (must be resolvable from container)
ARG NEXT_PUBLIC_API_URL=
ARG BACKEND_URL=http://backend:8000
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
ENV BACKEND_URL=${BACKEND_URL}
# Build the application
# Build the application (with standalone output)
RUN npm run build
# Production stage
# ---- Production stage ----
FROM node:20-alpine AS production
WORKDIR /app
# Set NODE_ENV before copying
ENV NODE_ENV=production
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001
# Copy built assets from builder
# Copy standalone output from builder
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
# Set correct permissions
# Set correct ownership
RUN chown -R nextjs:nodejs /app
USER nextjs
# Environment
ENV NODE_ENV=production \
PORT=3000 \
# Runtime environment
ENV PORT=3000 \
HOSTNAME="0.0.0.0"
EXPOSE 3000