Plugin (Users.permissions)

System Information
  • 4.14.0:
  • *Mac-os:
  • sql lite:
  • v16.20.1:
  • 8.19.4:
  • 1.22.19:

Hello guys,

In My case i wanna need to Override users-persmissions plugin register Func
example ( when create new user his email (email:"test@gmail.com) i need to override email field to
test@gmail.com.someThing) for some reason i’ve tried to use lifecycles beforeCreate Func but the i meet an problem with email validation so how did i can orverride this Function create new user to edit the email field before the func excuted

// src/extensions/users-permissions/strapi-server.js

i’ve tried this method but it’s failed (
module.exports = (plugin) => {

plugin.controllers.user.create = async (ctx) => {
console.log(ctx.request.body);

    ctx.request.body.email = ctx.request.body.email + "test",
    console.log(ctx.request.body.email)
   return await  strapi.query('plugin::users-permissions.user').create({data:ctx.request.body, populate: ['role'],})
};

//...

return plugin;

} it’s worked to create new user as i need but the problem the return statement not return any thing hte response is returned with null ;

can any one help