✨ Closes #273
This commit is contained in:
@@ -54,6 +54,7 @@ class Settings(BaseSettings):
|
||||
free_storage_limit: int = 1074000000
|
||||
pixabay_api_key: str | None = None
|
||||
mods: list[str] = []
|
||||
registration_disabled: bool = False
|
||||
|
||||
# storage_backend
|
||||
storage_backend: str | None = "local"
|
||||
|
||||
@@ -65,6 +65,8 @@ router.include_router(oauth.router, tags=["users", "oauth"], prefix="/oauth")
|
||||
response_model_include={"id": ..., "verified": ..., "email": ...},
|
||||
)
|
||||
async def create_user(user: RouteUser, background_task: BackgroundTasks) -> User | JSONResponse:
|
||||
if settings.registration_disabled:
|
||||
raise HTTPException(status_code=423)
|
||||
user = User(**user.dict(), id=uuid.uuid4(), avatar=gzipped_user_avatar(), created_at=datetime.now())
|
||||
try:
|
||||
validate_email(user.email)
|
||||
|
||||
Reference in New Issue
Block a user