From 4f81e862d9a7666fc9a7d5f4ed230f56573095e3 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Sat, 24 May 2025 23:04:03 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/auth.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.ts index 31119a39..ba616a93 100644 --- a/apps/api/src/auth.ts +++ b/apps/api/src/auth.ts @@ -1,4 +1,5 @@ import { assert, pick } from '@agentic/platform-core' +import { validators } from '@agentic/platform-validators' import { issuer } from '@openauthjs/openauth' import { GithubProvider } from '@openauthjs/openauth/provider/github' import { PasswordProvider } from '@openauthjs/openauth/provider/password' @@ -23,10 +24,29 @@ export const authRouter = issuer({ }), password: PasswordProvider( PasswordUI({ + copy: { + register_title: 'Welcome to Agentic', + login_title: 'Welcome to Agentic' + }, sendCode: async (email, code) => { // TODO: Send email code to user // eslint-disable-next-line no-console console.log({ email, code }) + }, + validatePassword: (password) => { + if (password.length < 3) { + return 'Password must be at least 3 characters' + } + + if (password.length > 1024) { + return 'Password must be less than 1024 characters' + } + + if (!validators.password(password)) { + return 'Invalid password' + } + + return undefined } }) )