productdevbook
01/25/2023, 7:09 AMts
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 ?rp_st
01/25/2023, 7:16 AMproductdevbook
01/25/2023, 7:20 AMrp_st
01/25/2023, 7:21 AMrp_st
01/25/2023, 7:21 AMrp_st
01/25/2023, 7:22 AMrp_st
01/25/2023, 7:22 AMrp_st
01/25/2023, 7:22 AMproductdevbook
01/25/2023, 7:41 AMts
options: {
preAPIHook: async (context) => {
context.requestInit.body = JSON.stringify({
...JSON.parse(context.requestInit.body as string),
token,
rePassword: values.rePassword,
})
return context
},
},
clientrp_st
01/25/2023, 7:41 AMproductdevbook
01/25/2023, 7:41 AMts
async resetPasswordUsingToken(input) {
console.log(input, 'inputk')
console.log('rePassword', (input.userContext._default.request as FastifyRequest).getJSONBody())
},
backend rePassword
iam see nowrp_st
01/25/2023, 7:41 AMproductdevbook
01/25/2023, 7:51 AMts
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 youproductdevbook
01/25/2023, 7:55 AMproductdevbook
01/25/2023, 7:55 AMpassword change
examplerp_st
01/25/2023, 8:02 AM