Skip to content

Commit

Permalink
feat: Add default values for Registration and ResetPassword forms
Browse files Browse the repository at this point in the history
  • Loading branch information
m453h committed Dec 5, 2024
1 parent cf6deea commit ed8517b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,75 @@ 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,
},
],
}),
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,
},
],
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ed8517b

Please sign in to comment.