refactor auth

This commit is contained in:
rubikscraft
2022-03-28 13:44:33 +02:00
parent 11d28abcca
commit 9d9a5983d8
9 changed files with 27 additions and 47 deletions

View File

@@ -11,7 +11,12 @@ export class LocalAuthStrategy extends PassportStrategy(Strategy, 'local') {
super();
}
async validate(username: string, password: string): AsyncFailable<EUserBackend> {
async validate(
username: string,
password: string,
): AsyncFailable<EUserBackend> {
// All this does is call the usersservice authenticate for authentication
const user = await this.usersService.authenticate(username, password);
if (HasFailed(user)) {
throw new UnauthorizedException();