Skip to main content
Version: 7.0.X

init

EmailPassword.init({
signUpFeature?: {
formFields?: {
id: string,
validate?: (value: any) => Promise<string | undefined>,
optional?: boolean,
}[]
},
resetPasswordUsingTokenFeature?: {
getResetPasswordURL?: (user: User) => Promise<string>,
createAndSendCustomEmail?: (user: User, passwordResetURLWithToken: string) => Promise<void>
},
emailVerificationFeature: {
getEmailVerificationURL?: (user: User) => Promise<string>,
createAndSendCustomEmail?: (user: User, emailVerificationURLWithToken: string) => Promise<void>
},
override?: {
apis?: function,
functions?: function
}
})

type User = {
id: string,
email: string,
timeJoined: number // this is only in CDI >= 2.5
}

Parameters#

signUpFeature#

  • formFields (Optional)
    • id
      • Id for the custom form field.
    • validate (Optional)
      • Custom validator for form field entry.
      • Default: undefined (No validation)
    • optional (Optional)
      • Set the custom field to be optional or not.
      • Default: false

resetPasswordUsingTokenFeature#

  • getResetPasswordURL (Optional)
    • Implement this to provide a custom reset password URL
    • Default: {websiteDomain}{websiteBasePath}/auth/reset-password
  • createAndSendCustomEmail (Optional)
    • Callback for creating and sending custom emails for password reset.
    • Default: Uses our APIs to send a password reset email.

emailVerificationFeature#

  • getEmailVerificationURL (Optional)
    • Implement this to provide a custom email verification URL
    • Default: {websiteDomain}{websiteBasePath}/auth/verify-email
  • createAndSendCustomEmail (Optional)
    • Callback for creating and sending custom emails for email verification.
    • Default: Uses our APIs to send an email verification email.

override (Optional)#

  • Use this feature to override how this recipe behaves
  • Default: undefined