diff --git a/app/auth/mutations/signup.ts b/app/auth/mutations/signup.ts index 6ebbca6..de100a1 100644 --- a/app/auth/mutations/signup.ts +++ b/app/auth/mutations/signup.ts @@ -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, diff --git a/app/auth/pages/sign-up.tsx b/app/auth/pages/sign-up.tsx index 291f01a..1494629 100644 --- a/app/auth/pages/sign-up.tsx +++ b/app/auth/pages/sign-up.tsx @@ -40,7 +40,7 @@ const SignUp: BlitzPage = () => { } }} > - + diff --git a/app/auth/validations.ts b/app/auth/validations.ts index 2710400..5b12cbb 100644 --- a/app/auth/validations.ts +++ b/app/auth/validations.ts @@ -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, }); diff --git a/app/settings/components/profile-informations.tsx b/app/settings/components/profile-informations.tsx index 8f1888f..d4fbcaf 100644 --- a/app/settings/components/profile-informations.tsx +++ b/app/settings/components/profile-informations.tsx @@ -12,7 +12,7 @@ import useCurrentUser from "../../core/hooks/use-current-user"; import appLogger from "../../../integrations/logger"; type Form = { - name: string; + fullName: string; email: string; }; @@ -30,17 +30,17 @@ const ProfileInformations: FunctionComponent = () => { const [errorMessage, setErrorMessage] = useState(""); useEffect(() => { - setValue("name", user?.name ?? ""); + setValue("fullName", user?.fullName ?? ""); setValue("email", user?.email ?? ""); }, [setValue, user]); - const onSubmit = handleSubmit(async ({ name, email }) => { + const onSubmit = handleSubmit(async ({ fullName, email }) => { if (isSubmitting) { return; } try { - await updateUserMutation({ email, name }); + await updateUserMutation({ email, fullName }); } catch (error: any) { logger.error(error.response, "error updating user infos"); setErrorMessage(error.response.data.errorMessage); @@ -68,16 +68,16 @@ const ProfileInformations: FunctionComponent = () => {
-