From 1287d8f7ac21fa76d85099743fbf75d10978dd64 Mon Sep 17 00:00:00 2001 From: tanshu Date: Wed, 30 Jun 2021 07:12:53 +0530 Subject: [PATCH] Fix: Whitespaces around the password/username were causing login failures. --- barker/barker/routers/login.py | 2 +- bookie/src/app/auth/login/login.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/barker/barker/routers/login.py b/barker/barker/routers/login.py index e9ed74a..64dd79c 100644 --- a/barker/barker/routers/login.py +++ b/barker/barker/routers/login.py @@ -39,7 +39,7 @@ async def login_for_access_token( device_id: Optional[uuid.UUID] = Cookie(None), ): with SessionFuture() as db: - user = authenticate_user(form_data.username, form_data.password, db) + user = authenticate_user(form_data.username.strip(), form_data.password.strip(), db) if not user: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, diff --git a/bookie/src/app/auth/login/login.component.ts b/bookie/src/app/auth/login/login.component.ts index 74d9901..5f51e7a 100644 --- a/bookie/src/app/auth/login/login.component.ts +++ b/bookie/src/app/auth/login/login.component.ts @@ -57,7 +57,7 @@ export class LoginComponent implements OnInit, AfterViewInit { const { username } = formModel; const { password } = formModel; this.auth - .login(username, password) + .login(username.trim(), password.trim()) // .pipe(first()) .subscribe( () => {