You will want to read through the extensions documentation on customizing a plugin.
And in this case it will most likely be in the controllers or the policy.
To extend these files you would create a local folder structure (part of it should already exist) of:
/extensions/users-permissions/controllers/somefile.js
/extensions/users-permissions/config/policies/somefile.js
And mirror over the contents of the file from the source, note that you will need to keep these files in sync manually for every Strapi update as they normally come from the node_modules