This commit is contained in:
Jörn-Michael Miehe 2022-03-28 22:25:37 +00:00
parent dbbe7a8c35
commit 567b863742

View file

@ -57,6 +57,7 @@ async def create_initial_admin(
if current_config is None: if current_config is None:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST) raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST)
# fail if any user exists
with Connection.session as db: with Connection.session as db:
if db.exec(select(User).limit(1)).first() is not None: if db.exec(select(User).limit(1)).first() is not None:
raise HTTPException(status_code=status.HTTP_409_CONFLICT) raise HTTPException(status_code=status.HTTP_409_CONFLICT)