From adb3866700c40eb4b670c2f739a47d302833decd Mon Sep 17 00:00:00 2001 From: mifi Date: Tue, 2 May 2023 20:23:19 -0400 Subject: [PATCH] linty fresh(er) --- lib/schema/auth.ts | 2 +- lib/utils/auth.ts | 4 ++-- lib/utils/jwt.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/schema/auth.ts b/lib/schema/auth.ts index 4dd2945..0bd47a0 100644 --- a/lib/schema/auth.ts +++ b/lib/schema/auth.ts @@ -22,7 +22,7 @@ export interface AuthMethods { getAuthStrategy(method?: STRATEGIES): Strategy | false; getResetLink(route: string): Promise; getResetToken(): Promise; - getToken(props?: Omit): string; + getToken(props?: Omit | void): string; setPassword(password: string): Promise; } diff --git a/lib/utils/auth.ts b/lib/utils/auth.ts index b8b8ae4..28e447d 100644 --- a/lib/utils/auth.ts +++ b/lib/utils/auth.ts @@ -5,8 +5,8 @@ import { sign } from './jwt'; export const getAuthenticationBundle = async (username: string, password: string) => { const auth = await Auth.findByUsername(username).catch(); const isAuthenticated = !!auth && (auth as AuthModel).authenticate(password); - const record = isAuthenticated ? (auth as AuthPrivate).record : null; - const token = isAuthenticated ? (auth as AuthModel).getToken() : sign(); + const record = isAuthenticated ? (auth as AuthPrivate).record as string : null; + const token = sign(record || undefined); return { record, token, diff --git a/lib/utils/jwt.ts b/lib/utils/jwt.ts index 6d4922a..1245505 100644 --- a/lib/utils/jwt.ts +++ b/lib/utils/jwt.ts @@ -1,4 +1,4 @@ -import jsonwebtoken, { JwtPayload } from 'jsonwebtoken'; +import jwt from 'jsonwebtoken'; export interface TokenProps { aud?: string;