Spaces:
Running
Running
deploy from github actions
Browse files- app/routers/admin.py +2 -1
app/routers/admin.py
CHANGED
|
@@ -107,7 +107,8 @@ async def login_admin(
|
|
| 107 |
form_data: OAuth2PasswordRequestForm = Depends(),
|
| 108 |
db: Session = Depends(get_db)
|
| 109 |
):
|
| 110 |
-
|
|
|
|
| 111 |
if not admin:
|
| 112 |
raise HTTPException(
|
| 113 |
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
|
|
| 107 |
form_data: OAuth2PasswordRequestForm = Depends(),
|
| 108 |
db: Session = Depends(get_db)
|
| 109 |
):
|
| 110 |
+
clean_username = form_data.username.strip().lower() if form_data.username else ""
|
| 111 |
+
admin = db.query(AdminUser).filter(func.lower(AdminUser.username) == clean_username).first()
|
| 112 |
if not admin:
|
| 113 |
raise HTTPException(
|
| 114 |
status_code=status.HTTP_401_UNAUTHORIZED,
|