I would like to add a checkbox in users-permissions when creating a new user, so that the user credentials are sent by email when the checkbox is checked (the password is only visible when the user is created). For this I have written a plugin that adds a checkbox to the frontent. In the backend (extensions/users-permissions/content-types/user/lifecycles.js) I created the function beforeCreate(event). Frontend and backend work as intended.
My problem is how can I send the value of the checkbox from the frontend to the backend.
I have a question, do you want to send the credentials email to the user only after account creation OR you also want it after credentials update from the user profile?
currently I want to send the credentials only after the account creation, because after that the user can update his password himself via “Forgot your password”. I need this functionality only because of the password.
Do you have an alternative idea how I can realize this? I am free in how I implement in that regard.
I currently have a solution, but it’s not very pretty/professional because I insert a prefix string in the email and delete it again in beforeCreate
Well, I had similar kind of requirement in the past and I already had a solution for that.
What I actually developed is that whenever any user is created from the Frontend or from strapi, an email is executed from the index.js file using afterCreate() hook.
thanks for your solution, but the email should not always be sent.
In a nutshell: we have built a kind of “news portal” for many business customers. When a customer decides to book the service, first the users are created (without sending an email), the account is set up and tested. When the service is activated some time later, all credentials are sent at once. We need this functionality only for individual stragglers (hence the checkbox).