Files
techtracker/convex/CustomPassword.ts
2025-09-03 09:03:34 -05:00

23 lines
586 B
TypeScript

import { ConvexError } from 'convex/values';
import { Password } from '@convex-dev/auth/providers/Password';
import type { DataModel } from './_generated/dataModel';
export default Password<DataModel>({
profile(params, ctx) {
return {
email: params.email as string,
name: params.name as string,
};
},
validatePasswordRequirements: (password: string) => {
if (
password.length < 8 ||
!/\d/.test(password) ||
!/[a-z]/.test(password) ||
!/[A-Z]/.test(password)
) {
throw new ConvexError('Invalid password.');
}
},
});