0

how can I set "disabled user" as default configuration to any new user which register on, then send to any administrator an email saying "new user!!" and the administrator could anable the new user and send to him an email to let him know was approved

1 Answer 1

4

You will have to customize the register function.

To do so, you will have to use the extensions folder.

See the documentation here: https://strapi.io/documentation/3.0.0-beta.x/concepts/concepts.html#extensions

Here is the register function you will have to update: https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/controllers/Auth.js#L358

You will have to create ./extensions/users-permissions/controllers/Auth.js file that contains a module.exports with only the register function inside. Copy the plugin's one and paste it in the extension file we just created.

Then in you extend register function, you will have to update the params object and set the blocked key to true. Just after this line https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/controllers/Auth.js#L378.

Then if you want to send an email, you can use the email plugin that provides you a way to send emails.

Here is the example of how we send confirmation email: https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/controllers/Auth.js#L508

Copy this line and update values to send an email to yourself with the content you want.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.