Private
Public Access
Site admins can invite a brand-new person by email from the Admin portal Users tab -- a signup-link email lets them set their own username/password and lands them in the app already logged in. Existing users invited to a room now also get an email. Closes the "invited but never notified" gap from both directions. SMTP is configured through the Admin Settings tab at runtime (not the env file), persisted in a new smtp_settings table with the password encrypted at rest via a Fernet key derived from SESSION_SECRET -- the first reversible secret this app stores in the database. A "send test email" button surfaces real delivery errors; the invite/notification paths themselves never fail loudly, since an SMTP outage shouldn't block an action that already succeeded in the database. New site_invites table mirrors RoomInvite's shape but targets an email address with no room context; the raw signup token is hashed the same way API tokens are, and only ever exists in the email link. POST /api/signup is the first genuinely public, unauthenticated account-creation endpoint in this app, reusing the existing register_user path for identical validation.
25 lines
645 B
Python
25 lines
645 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, EmailStr, Field
|
|
|
|
|
|
class SmtpSettingsUpdate(BaseModel):
|
|
host: str = Field(min_length=1, max_length=255)
|
|
port: int = Field(ge=1, le=65535)
|
|
username: str | None = None
|
|
# None/omitted = keep the existing password unchanged -- the frontend
|
|
# never has the plaintext to send back, only whether one is set.
|
|
password: str | None = None
|
|
from_address: EmailStr
|
|
use_tls: bool = True
|
|
|
|
|
|
class SmtpSettingsRead(BaseModel):
|
|
host: str
|
|
port: int
|
|
username: str | None
|
|
has_password: bool
|
|
from_address: str
|
|
use_tls: bool
|
|
updated_at: datetime
|