linty fresh(er)
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-05-02 20:23:19 -04:00
parent d47c229178
commit adb3866700
3 changed files with 4 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ export interface AuthMethods {
getAuthStrategy(method?: STRATEGIES): Strategy | false; getAuthStrategy(method?: STRATEGIES): Strategy | false;
getResetLink(route: string): Promise<string | undefined>; getResetLink(route: string): Promise<string | undefined>;
getResetToken(): Promise<string | undefined>; getResetToken(): Promise<string | undefined>;
getToken(props?: Omit<TokenProps, 'sub'>): string; getToken(props?: Omit<TokenProps, 'sub'> | void): string;
setPassword(password: string): Promise<boolean>; setPassword(password: string): Promise<boolean>;
} }

View File

@@ -5,8 +5,8 @@ import { sign } from './jwt';
export const getAuthenticationBundle = async (username: string, password: string) => { export const getAuthenticationBundle = async (username: string, password: string) => {
const auth = await Auth.findByUsername(username).catch(); const auth = await Auth.findByUsername(username).catch();
const isAuthenticated = !!auth && (auth as AuthModel).authenticate(password); const isAuthenticated = !!auth && (auth as AuthModel).authenticate(password);
const record = isAuthenticated ? (auth as AuthPrivate).record : null; const record = isAuthenticated ? (auth as AuthPrivate).record as string : null;
const token = isAuthenticated ? (auth as AuthModel).getToken() : sign(); const token = sign(record || undefined);
return { return {
record, record,
token, token,

View File

@@ -1,4 +1,4 @@
import jsonwebtoken, { JwtPayload } from 'jsonwebtoken'; import jwt from 'jsonwebtoken';
export interface TokenProps { export interface TokenProps {
aud?: string; aud?: string;