frontend: add username login

This commit is contained in:
2024-06-08 19:18:15 -04:00
parent 8e6e5ea903
commit 79f511c837
4 changed files with 17 additions and 9 deletions

View File

@ -308,8 +308,12 @@ class FE_Gate(FE_Base):
uid = await self.data.card.get_user_id_from_card(access_code)
if uid is None:
self.logger.debug(f"Failed to find user for card {access_code}")
return RedirectResponse("/gate/?e=1", 303)
user = await self.data.user.get_user_by_username(access_code) # Lookup as username
if not user:
self.logger.debug(f"Failed to find user for card/username {access_code}")
return RedirectResponse("/gate/?e=1", 303)
uid = user['id']
user = await self.data.user.get_user(uid)
if user is None: