mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 18:42:34 +01:00
pr-ready step 2 follow-up. The frontend resends the email on every save, so trusting it on any admin save let enabling an invitee vouch for an address nobody checked. An admin now sends confirm_email (the address they saw) from a switch in the edit dialog; a changed address answers 409. UserSchema exposes email_trusted and the edit audit records it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
from fastapi import UploadFile
|
|
from fastapi.param_functions import Form
|
|
from pydantic import BaseModel, Field
|
|
|
|
from models.user import TEXT_FIELD_LENGTH
|
|
|
|
|
|
class UserForm(BaseModel):
|
|
username: str | None = None
|
|
password: str | None = None
|
|
current_password: str | None = None
|
|
email: str | None = None
|
|
# The address an admin confirms; it must still be the user's current email.
|
|
confirm_email: str | None = None
|
|
role: str | None = None
|
|
enabled: bool | None = None
|
|
ra_username: str | None = Field(default=None, max_length=TEXT_FIELD_LENGTH)
|
|
avatar: UploadFile | None = None
|
|
ui_settings: str | None = None
|
|
|
|
|
|
class OAuth2RequestForm:
|
|
def __init__(
|
|
self,
|
|
grant_type: str = Form(default="password"),
|
|
scope: str = Form(default=""),
|
|
username: str | None = Form(default=None),
|
|
password: str | None = Form(default=None),
|
|
client_id: str | None = Form(default=None),
|
|
client_secret: str | None = Form(default=None),
|
|
refresh_token: str | None = Form(default=None),
|
|
):
|
|
self.grant_type = grant_type
|
|
self.scopes = scope.split()
|
|
self.username = username
|
|
self.password = password
|
|
self.client_id = client_id
|
|
self.client_secret = client_secret
|
|
self.refresh_token = refresh_token
|