make user full name mandatory
This commit is contained in:
@ -4,12 +4,12 @@ import db, { GlobalRole, MembershipRole } from "../../../db";
|
||||
import { Signup } from "../validations";
|
||||
import { computeEncryptionKey } from "../../../db/_encryption";
|
||||
|
||||
export default resolver.pipe(resolver.zod(Signup), async ({ email, password, name }, ctx) => {
|
||||
export default resolver.pipe(resolver.zod(Signup), async ({ email, password, fullName }, ctx) => {
|
||||
const hashedPassword = await SecurePassword.hash(password.trim());
|
||||
const encryptionKey = computeEncryptionKey(email.toLowerCase().trim()).toString("hex");
|
||||
const user = await db.user.create({
|
||||
data: {
|
||||
name: name.trim(),
|
||||
fullName: fullName.trim(),
|
||||
email: email.toLowerCase().trim(),
|
||||
hashedPassword,
|
||||
role: GlobalRole.CUSTOMER,
|
||||
|
@ -40,7 +40,7 @@ const SignUp: BlitzPage = () => {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<LabeledTextField name="name" label="Name" type="text" />
|
||||
<LabeledTextField name="fullName" label="Full name" type="text" />
|
||||
<LabeledTextField name="email" label="Email" type="email" />
|
||||
<LabeledTextField name="password" label="Password" type="password" />
|
||||
</Form>
|
||||
|
@ -3,7 +3,7 @@ import { z } from "zod";
|
||||
export const password = z.string().min(10).max(100);
|
||||
|
||||
export const Signup = z.object({
|
||||
name: z.string(),
|
||||
fullName: z.string(),
|
||||
email: z.string().email(),
|
||||
password,
|
||||
});
|
||||
|
Reference in New Issue
Block a user