fix: ran linting for both backend and frontend

This commit is contained in:
Anish Sarkar 2025-10-20 16:25:14 +05:30
parent 19ed0becce
commit fd94193fd5
2 changed files with 20 additions and 14 deletions

View file

@ -17,11 +17,15 @@ async def lifespan(app: FastAPI):
await create_db_and_tables() await create_db_and_tables()
yield yield
def registration_allowed(): def registration_allowed():
if not config.REGISTRATION_ENABLED: if not config.REGISTRATION_ENABLED:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Registration is disabled") raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN, detail="Registration is disabled"
)
return True return True
app = FastAPI(lifespan=lifespan) app = FastAPI(lifespan=lifespan)
# Add CORS middleware # Add CORS middleware
@ -67,7 +71,9 @@ if config.AUTH_TYPE == "GOOGLE":
), ),
prefix="/auth/google", prefix="/auth/google",
tags=["auth"], tags=["auth"],
dependencies=[Depends(registration_allowed)], # blocks OAuth registration when disabled dependencies=[
Depends(registration_allowed)
], # blocks OAuth registration when disabled
) )
app.include_router(crud_router, prefix="/api/v1", tags=["crud"]) app.include_router(crud_router, prefix="/api/v1", tags=["crud"])

View file

@ -65,18 +65,18 @@ export default function RegisterPage() {
const data = await response.json(); const data = await response.json();
if (!response.ok && response.status === 403) { if (!response.ok && response.status === 403) {
const friendlyMessage = const friendlyMessage =
"Registrations are currently closed. If you need access, contact your administrator."; "Registrations are currently closed. If you need access, contact your administrator.";
setErrorTitle("Registration is disabled"); setErrorTitle("Registration is disabled");
setError(friendlyMessage); setError(friendlyMessage);
toast.error("Registration is disabled", { toast.error("Registration is disabled", {
id: loadingToast, id: loadingToast,
description: friendlyMessage, description: friendlyMessage,
duration: 6000, duration: 6000,
}); });
setIsLoading(false); setIsLoading(false);
return; return;
} }
if (!response.ok) { if (!response.ok) {
throw new Error(data.detail || `HTTP ${response.status}`); throw new Error(data.detail || `HTTP ${response.status}`);