aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/auth.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/trpc/auth.ts')
-rw-r--r--packages/trpc/auth.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/trpc/auth.ts b/packages/trpc/auth.ts
index 39aebd3b..1efbdde6 100644
--- a/packages/trpc/auth.ts
+++ b/packages/trpc/auth.ts
@@ -4,6 +4,7 @@ import * as bcrypt from "bcryptjs";
import { db } from "@hoarder/db";
import { apiKeys } from "@hoarder/db/schema";
import serverConfig from "@hoarder/shared/config";
+import { authFailureLogger } from "@hoarder/shared/logger";
// API Keys
@@ -102,3 +103,13 @@ export async function validatePassword(email: string, password: string) {
return user;
}
+
+export function logAuthenticationError(
+ user: string,
+ message: string,
+ ip: string | null,
+): void {
+ authFailureLogger.error(
+ `Authentication error. User: "${user}", Message: "${message}", IP-Address: "${ip}"`,
+ );
+}