haydn
07/13/2022, 4:57 AMinvitePerson
, acceptInvite
, resetPassword
etc). Also, we've got our own email service (email templates as well as sending method), so just looking to generate tokens that we can use to construct our own links.rp_st
07/13/2022, 5:39 AMrp_st
07/13/2022, 5:40 AMoverride.apis.signUp
to undefined
, in the EmailPassword.init on the backend config.rp_st
07/13/2022, 5:41 AMsignUp
function (https://supertokens.com/docs/nodejs/modules/recipe_emailpassword.html#signUp-1) with a throw away password and the user's email. This function will return the new user's userId. You then want to call the createResetPasswordToken
(https://supertokens.com/docs/nodejs/modules/recipe_emailpassword.html#createResetPasswordToken-1) function to generate a reset password token for them.rp_st
07/13/2022, 5:42 AM{websiteDomain}/{websiteBasePath}/reset-password?token={token}&rid=emailpassword
. Otherwise you can make the link however you like.rp_st
07/13/2022, 5:43 AMrp_st
07/13/2022, 5:43 AMEmailPassword.init({
override: {
apis: (oI) => {
return {
...oI,
signUpPOST: undefined, // disabling the sign up API
signInPOST: async function (input) {
let password = input.formFields.filter(i => i.id === "password")[0];
if (password === THROWAWAY_PASSWORD) {
// On our prebuilt UI, this will show a message on the frontend like "Incorrect credentials"
return {
status: "WRONG_CREDENTIALS_ERROR"
}
}
return oI.signInPOST!(input);
},
passwordResetPOST: async function (input) {
let password = input.formFields.filter(i => i.id === "password")[0];
if (password === THROWAWAY_PASSWORD) {
// The user is trying to change their password to the
// throw away password. Disallow that
return {
status: "GENERAL_ERROR",
message: "Please use another password"
}
}
return oI.passwordResetPOST!(input)
}
}
}
}
})
rp_st
07/13/2022, 5:43 AMhaydn
07/13/2022, 6:20 AMrp_st
08/05/2022, 2:14 PM