I'm using Strapi for my API and Back office. Everything works fine except one thing: I can't figure out how to override the controller that is used for the forgot password feature. I've tried to follow the documentation, especially this page : https://strapi.io/documentation/3.0.0-beta.x/admin-panel/customization.html#development-mode but no chance.
Here what I've tried :
admin
at the root of the project, inside which I created controller/Auth.js
. In this file I created my custom forgotPassword function but it's not called. admin/config/routes.json
, my controller got the same name but I thought that maybe I need to repeat the route here to override, still not successful. /extensions/user-permissions/admin
, but it's still not working.Whatever I try, it's always the default forgot password controller that is called, from the strapi-admin node modules.
Any help would be greatly appreciated, I don't see what I'm missing here.
It's normal, because your are not writing the file in the right place.
So I will help you with that.
First here is the documentation for the customization - https://strapi.io/documentation/3.0.0-beta.x/concepts/customization.html#plugin-extensions
Then we have to find the file in the code source we want to update.
Here is the function - https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/controllers/Auth.js#L266
Based on the file path and the way to customize in strapi.
You will have to create a file to this path extensions/users-permissions/controllers/Auth.js
Then create a module.exports
with source code function and the update it.
this should work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With