Isaac105 commited on
Commit
447ecc2
·
1 Parent(s): 60d7278

deploy from github actions

Browse files
Files changed (1) hide show
  1. 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
- admin = db.query(AdminUser).filter(AdminUser.username == form_data.username).first()
 
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,