Hello everyone,
I have read several similar threads regarding this topic, but I can’t find the solution to my issue.
What I want:
- create user via UI
- disable automatic sending of verification emails (since I want to add some required metadata)
- after user is created, I add some metadata
- click in UI on verify email, so that the user gets the verification email
I am kind of lost here, since this process works if I create the user via API call i.e.
--data-raw '{"email":"email@address.com","blocked":true,"email_verified":false,"family_name":"Familiy_Name","password":"supersecret","connection":"Username-Password-Authentication","verify_email":false}'
I can see the requested App Metadata block
When I click on “Actions - Send Verification Email”, I get the desired email to verify myself.
I have also defined a pre-user and post-user-registration action like this:
exports.onExecutePreUserRegistration = async (event, api) => {
// Set email_verified to false
api.user.setAppMetadata('email_verified', false);
api.user.setAppMetadata('verify_email', false);
api.user.setAppMetadata('blocked', true);
// Add a flag to track unverified status
api.user.setAppMetadata('verification_status', {
verified: false,
created_at: new Date().toISOString()
});
// Prevent verification email from being sent
api.user.setAppMetadata('suppress_verification_email', true);
};
and
exports.onExecutePostUserRegistration = async (event, api) => {
// Set email_verified to false
api.user.setAppMetadata('email_verified', false);
api.user.setAppMetadata('verify_email', false);
api.user.setAppMetadata('blocked', true);
// Add a flag to track unverified status
api.user.setAppMetadata('verification_status', {
verified: false,
created_at: new Date().toISOString()
});
// Prevent verification email from being sent
api.user.setAppMetadata('suppress_verification_email', true);
};
I can see that the App Metadata ist actually filled out like expected, but the behaviour is just wrong. The user is unlocked, the verification email is send.
Any ideas/suggestions on that topic?
Cheers