https://supertokens.com/ logo
Title
k

kabin

10/18/2022, 6:28 AM
i want to send email after user password resetted to inform user his password is resetted
r

rp

10/18/2022, 6:30 AM
hey @kabin which backend SDk are you using?
k

kabin

10/18/2022, 6:34 AM
using fastify in backend
nodejs
r

rp

10/18/2022, 6:35 AM
and which recipe are you using of supertokens?
emailpassword or thirdpartyemailpassword?
k

kabin

10/18/2022, 6:37 AM
emailpassword
r

rp

10/18/2022, 6:40 AM
Try something like this on the backend EmailPassword.init
ts
EmailPassword.init({
    override: {
        apis: (oI) => {
            return {
                ...oI,
                passwordResetPOST: async function (input) {
                    let resp = await oI.passwordResetPOST!(input);
                    if (resp.status === "OK") {
                        let userId = resp.userId!;
                        let userInfo = await EmailPassword.getUserById(userId);
                        let email = userInfo?.email;
                        // send email...
                    }
                    return resp;
                }
            }
        }
    }
})
k

kabin

10/18/2022, 8:05 AM
i want to know if there's a supertoken's way to send mail sfter password reset response status in ok
r

rp

10/18/2022, 8:07 AM
there isn't. We don't send post password reset emails. So you will have to do that on your own
k

kabin

10/18/2022, 8:17 AM
ok thanks for hellp