Move to monorepo for React Native!
This commit is contained in:
18
packages/backend/convex/CustomPassword.ts
Normal file
18
packages/backend/convex/CustomPassword.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { ConvexError } from 'convex/values';
|
||||
import { Password } from '@convex-dev/auth/providers/Password';
|
||||
import { validatePassword } from './auth';
|
||||
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 (!validatePassword(password)) {
|
||||
throw new ConvexError('Invalid password.');
|
||||
}
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user