I want to customize the forgot passord flow. of the User Permissions plugin
Currently the system sends an email with a long base64 code. I want to modify that code to a 6-digit temporary code (for using in mobile app). What is the best way to do it? I have some options in mind:
(1) Completely rewrite the APIs to handle the flow
(2) Use a middleware to modify the ctx request & response (as instructed here: Extending /auth/local/register endpoint with custom logic - #4 by Konstantin_Cube)
Option 1 requires too much work which I do not prefer.
Option 2 seems to extend the API, not modify the API.
My short question is, how could I replace the default route defined here
{
method: âPOSTâ,
path: â/auth/forgot-passwordâ,
handler: âauth.forgotPasswordâ,
config: {
middlewares: [âplugin::users-permissions.rateLimitâ],
prefix: ââ,
},
}
â change the âhandlerâ to my own function?