From ed8517b0623dcd75c3ef8a44b6e19ca2e08bbc47 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Thu, 5 Dec 2024 13:47:47 +0300 Subject: [PATCH] feat: Add default values for Registration and ResetPassword forms --- .../Forms/registration/RegistrationTab.js | 44 +++++++++++++++++-- .../Forms/resetPassword/ResetPasswordTab.js | 9 +++- .../globals/Forms/resetPassword/index.js | 2 +- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/apps/civicsignalblog/src/payload/globals/Forms/registration/RegistrationTab.js b/apps/civicsignalblog/src/payload/globals/Forms/registration/RegistrationTab.js index b3df3fd03..f0ac3cf5d 100644 --- a/apps/civicsignalblog/src/payload/globals/Forms/registration/RegistrationTab.js +++ b/apps/civicsignalblog/src/payload/globals/Forms/registration/RegistrationTab.js @@ -28,22 +28,36 @@ const RegisterTab = { type: "collapsible", label: "Fields", fields: [ - formInputFieldGroup({ label: "E-mail", name: "email" }), - formInputFieldGroup({ label: "Full Name", name: "fullName" }), + formInputFieldGroup({ + label: "E-mail", + name: "email", + defaultLabelValue: "Email", + defaultErrorMessage: "You need to enter a valid email address.", + }), + formInputFieldGroup({ + label: "Full Name", + name: "fullName", + includeErrorMessageField: false, + defaultLabelValue: "Full Name", + }), formInputFieldGroup({ label: "Password", name: "password", + defaultLabelValue: "Password", + defaultErrorMessage: "You need to enter your password.", additionalFields: [ { name: "passwordsMismatch", type: "text", required: true, + defaultValue: "You need to enter your password.", localized: true, }, { name: "passwordTooShort", type: "text", required: true, + defaultValue: "Passwords must be at least 8 characters long.", localized: true, }, ], @@ -51,14 +65,38 @@ const RegisterTab = { formInputFieldGroup({ label: "Confirm Password", name: "confirmPassword", + defaultLabelValue: "Confirm Password", includeErrorMessageField: false, }), formInputFieldGroup({ label: "Notes", name: "notes", + defaultHint: + "Tell us a little about what you want to use Media Cloud for", + defaultLabelValue: "Notes", + defaultErrorMessage: + "You have to tell us a little about why you want to use Media Cloud.", includeHintField: true, }), - formInputFieldGroup({ label: "Consent", name: "consent" }), + { + type: "collapsible", + label: "Consent", + fields: [ + richText({ + name: "consentLabel", + label: "Label", + required: true, + localized: true, + }), + { + name: "consentError", + type: "text", + defaultValue: "You must agree to our Terms and Policies", + required: true, + localized: true, + }, + ], + }, ], }, { diff --git a/apps/civicsignalblog/src/payload/globals/Forms/resetPassword/ResetPasswordTab.js b/apps/civicsignalblog/src/payload/globals/Forms/resetPassword/ResetPasswordTab.js index 75a0b8c4e..9941b24fc 100644 --- a/apps/civicsignalblog/src/payload/globals/Forms/resetPassword/ResetPasswordTab.js +++ b/apps/civicsignalblog/src/payload/globals/Forms/resetPassword/ResetPasswordTab.js @@ -27,7 +27,14 @@ const ResetPassword = { { type: "collapsible", label: "Fields", - fields: [formInputFieldGroup({ label: "E-mail", name: "email" })], + fields: [ + formInputFieldGroup({ + label: "E-mail", + name: "email", + defaultLabelValue: "Email", + defaultErrorMessage: "You need to enter a valid email address.", + }), + ], }, { type: "collapsible", diff --git a/apps/civicsignalblog/src/payload/globals/Forms/resetPassword/index.js b/apps/civicsignalblog/src/payload/globals/Forms/resetPassword/index.js index 15b6d85fb..35bacf457 100644 --- a/apps/civicsignalblog/src/payload/globals/Forms/resetPassword/index.js +++ b/apps/civicsignalblog/src/payload/globals/Forms/resetPassword/index.js @@ -4,7 +4,7 @@ import settings from "#civicsignalblog/payload/utils/createGlobalSettings"; const ResetPassword = settings({ slug: `reset-password-form`, - label: "Password", + label: "Password Reset", group: "Forms", access: { read: () => true,