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.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/trpc/auth.ts b/packages/trpc/auth.ts
index 846c07b6..39aebd3b 100644
--- a/packages/trpc/auth.ts
+++ b/packages/trpc/auth.ts
@@ -3,6 +3,7 @@ import * as bcrypt from "bcryptjs";
import { db } from "@hoarder/db";
import { apiKeys } from "@hoarder/db/schema";
+import serverConfig from "@hoarder/shared/config";
// API Keys
@@ -79,6 +80,9 @@ export async function hashPassword(password: string) {
}
export async function validatePassword(email: string, password: string) {
+ if (serverConfig.auth.disablePasswordAuth) {
+ throw new Error("Password authentication is currently disabled");
+ }
const user = await db.query.users.findFirst({
where: (u, { eq }) => eq(u.email, email),
});