feat: add email-based authentication

This commit is contained in:
2026-08-03 18:49:08 +08:00
parent 82a8b4187a
commit f2209a0e00
19 changed files with 641 additions and 1555 deletions
+29 -17
View File
@@ -1,28 +1,40 @@
# Copy to .env for local deployment.
# Generate SECRET_KEY with: python -c "import secrets; print(secrets.token_hex(32))"
SECRET_KEY=change-me-to-a-long-random-secret
# 环境变量模板:复制为 .env 后填写实际值。不要提交 .env 或 .env.local。
# 优先级:系统环境变量 > .env.local > .env。
# Runtime mode is not set by docker compose. Local python runs default to development;
# the Docker image sets APP_ENV=production and DEBUG=false in the image.
# 运行环境:production(生产)/ development(开发)
APP_ENV=production
# 是否开启 Flask 调试与热重载。生产必须为 false。
DEBUG=false
# 会话加密密钥。执行 python -c "import secrets; print(secrets.token_hex(32))" 生成。
SECRET_KEY=replace-with-a-long-random-secret
# Required for first deployment. Used to create or rotate the admin account on startup.
# 首次启动时创建管理员;之后不会用这些值覆盖管理员密码。
ADMIN_USERNAME=admin
ADMIN_PASSWORD=change-me
ADMIN_PASSWORD=replace-with-a-strong-password
ADMIN_EMAIL=admin@waternetwork.cn
# Persist the app database in the mounted ./data directory.
# 数据库连接。默认使用项目 data 目录中的 SQLite 文件。
DATABASE_URL=sqlite:////app/data/pipe_survival_0331.db
# Timezone used when displaying UTC timestamps.
# 页面展示的时区。
APP_TIMEZONE=Asia/Shanghai
# Default: 16 MiB
# 单个上传文件最大字节数,16 MiB = 16777216。
MAX_UPLOAD_BYTES=16777216
# Default RC1 fusion model core directory inside the Docker image.
# 模型核心目录。
FUSION_MODEL_CORE_DIR=/app/model_core
# Keep public registration closed by default.
# 是否允许公开自助注册。
ALLOW_REGISTRATION=false
# Minutes before an admin-generated password reset link expires.
PASSWORD_RESET_TOKEN_MINUTES=30
# Resend 邮件服务。发件地址必须已在 Resend 验证。
RESEND_API_KEY=re_xxxxxxxxx
RESEND_FROM_EMAIL=no-reply@waternetwork.cn
# 邮件验证码:有效期(分钟)、重发间隔(秒)、最大尝试次数。
EMAIL_CODE_MINUTES=10
EMAIL_CODE_RESEND_SECONDS=60
EMAIL_CODE_MAX_ATTEMPTS=5
# 受信设备的有效期(天)。
TRUSTED_DEVICE_DAYS=30
# HTTPS 下必须为 true;本地 HTTP 开发环境设为 false。
SESSION_COOKIE_SECURE=true