```ts const response = await ThirdPartyEmailPassword.submitNewPassword({ formFields: [ ...
p
Copy code
ts
   const response = await ThirdPartyEmailPassword.submitNewPassword({
        formFields: [
          {
            id: 'password',
            value: values.password,
          },
          {
            id: 'rePassword',
            value: values.rePassword,
          },
        ],
      })
{"message":"Are you sending too many / too few formFields?"} how to send rePassword ?
r
hey! You need to add this to the formFields on the backend config as well
p
emtpy TS
r
Ohh. Ur talking about the reset password api. Right
That can’t accept extra form fields
Instead, use the pre api hook to add the custom field to the request body dirercyly
And access that using the req object on the backend
You can search discord for how this is done. It’s come up a few times already
p
Copy code
ts
  options: {
          preAPIHook: async (context) => {
            context.requestInit.body = JSON.stringify({
              ...JSON.parse(context.requestInit.body as string),
              token,
              rePassword: values.rePassword,
            })
            return context
          },
        },
client
r
yea.
p
Copy code
ts
   async resetPasswordUsingToken(input) {
                console.log(input, 'inputk')
                console.log('rePassword', (input.userContext._default.request as FastifyRequest).getJSONBody())
              },
backend
rePassword
iam see now
r
yes
p
Copy code
ts
    async resetPasswordUsingToken(input) {
                const request = (input.userContext._default.request as FastifyRequest).getJSONBody()
                const body = await request
                if (!body)
                  throw new Error('There was a problem resetting the password.')

                const passwordMatchRegexp
                  = /^.*(?=.{8,})((?=.*[!@#$%^&*()\-_=+{};:,<.>]){1})(?=.*\d)((?=.*[a-z]){1})((?=.*[A-Z]){1}).*$/

                if (!passwordMatchRegexp.test(input.newPassword))
                  throw new Error('Password must be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one number and one special character')

                if (body.rePassword !== input.newPassword)
                  throw new Error('Passwords do not match')

},
working !! Thank you
how to token get user email address ? or id
because iam send email
password change
example
r
You can get their email only after calling the original implementation. After token has been consumed.