Open
feat(auth): 补齐找回密码、改密与全端登出 #7
feat(auth): 补齐找回密码、改密与全端登出 #7
Open
jaxAdd on Sep 8
Total: 9 files changed+1147-16
@@ -83,14 +83,30 @@ AUTH_PUBLIC_BASE_URL=http://127.0.0.1:3000
83# Exposed via GET /api/v1/auth/status (no secrets). Do not use AUTH_EMAIL_DELIVERY=test83# Exposed via GET /api/v1/auth/status (no secrets). Do not use AUTH_EMAIL_DELIVERY=test
84# with a non-loopback AUTH_PUBLIC_BASE_URL.84# with a non-loopback AUTH_PUBLIC_BASE_URL.
85AUTH_REGISTRATION_MODE=open85AUTH_REGISTRATION_MODE=open
86-# Required when set: only smtp|test. test = log links to console; smtp = send real email.86+# Required when set: only smtp|test. test = tokens returned inline in the API
87+# response (loopback only); smtp = send real email via AUTH_SMTP_* below.
88+# With smtp selected but AUTH_SMTP_HOST empty, auth emails are dropped with a
89+# warning rather than failing the request — verification and password reset then
90+# cannot be delivered.
87AUTH_EMAIL_DELIVERY=test91AUTH_EMAIL_DELIVERY=test
88AUTH_EMAIL_FROM=DataFoundry <no-reply@example.com>92AUTH_EMAIL_FROM=DataFoundry <no-reply@example.com>
89AUTH_SMTP_HOST=smtp.example.com93AUTH_SMTP_HOST=smtp.example.com
94+# Defaults to 587 with STARTTLS, or 465 when AUTH_SMTP_SECURE=true.
90AUTH_SMTP_PORT=58795AUTH_SMTP_PORT=587
96+# true = implicit TLS (SMTPS). Use AUTH_SMTP_SECURITY=starttls|ssl|none to
97+# override explicitly; `none` disables TLS and should only be used for a
98+# trusted local relay.
91AUTH_SMTP_SECURE=false99AUTH_SMTP_SECURE=false
92AUTH_SMTP_USER=100AUTH_SMTP_USER=
93AUTH_SMTP_PASSWORD=101AUTH_SMTP_PASSWORD=
102+AUTH_SMTP_TIMEOUT=10
103+ 
104+# Throttle for POST /api/v1/auth/password/forgot, applied per client address and
105+# per target address within a sliding window. In-process only: a multi-replica
106+# deployment needs a shared limiter or an edge rate limit.
107+AUTH_PASSWORD_RESET_IP_LIMIT=5
108+AUTH_PASSWORD_RESET_EMAIL_LIMIT=3
109+AUTH_PASSWORD_RESET_WINDOW_SECONDS=900
94 110 
95# Next.js BFF (apps/web) → API. Set this in apps/web/.env.local (not required in root .env).111# Next.js BFF (apps/web) → API. Set this in apps/web/.env.local (not required in root .env).
96# Used in password / formal mode when the browser calls same-origin `/api/v1/*` and `/api/copilotkit`.112# Used in password / formal mode when the browser calls same-origin `/api/v1/*` and `/api/copilotkit`.
Mapps/api/src/datafoundry_api/app.py+50-0File content is under review, please try again later
Mapps/api/src/datafoundry_api/auth.py+191-15File content is under review, please try again later
Aapps/api/src/datafoundry_api/emailer.py+125-0File content is under review, please try again later
Aapps/api/src/datafoundry_api/rate_limit.py+42-0File content is under review, please try again later
Mapps/api/src/datafoundry_api/settings.py+57-0File content is under review, please try again later
Aapps/api/tests/test_auth_email_delivery.py+213-0File content is under review, please try again later
Aapps/api/tests/test_auth_password_recovery.py+292-0File content is under review, please try again later
Aapps/api/tests/test_auth_sessions_and_change_password.py+160-0File content is under review, please try again later