Replace auth.js controller

System Information
  • Strapi Version: 5.0.0
  • Operating System: MacOS
  • Database: postres
  • Node Version: 18
  • NPM Version: 10.8.3
  • Yarn Version:

I would like to change the behavior of the callback function for the auth controller placed in @strapi/plugin-users-permissions/server/controllers/auth.js

Specifically this piece of code that I would like to eliminate from the authentication:

const advancedSettings = await store.get({ key: 'advanced' });
const requiresConfirmation = _.get(advancedSettings, 'email_confirmation');

if (requiresConfirmation && user.confirmed !== true) {
    throw new ApplicationError('Your account email is not confirmed');
}

I expect that every user can authenticate to Strapi even if their emails are not confirmed.

Should I create a controller in api/auth/local/controllers/ that replaces the default one? In that case how? I didn’t succeed so far. Seems that the api is still using the default one anyway.

The solution proposed in this thread doesn’t seem to work.