Resend confirmation email rule/button

Thank you very much for the help @dan.woda, made it work with the topic you sent :slight_smile:
Have a great weekend, cheers.

Solution

Rule function code:

function (user, context, callback) {
   user.user_metadata = user.user_metadata || {};
   if (user.email_verified || user.user_metadata.verification_email_sent) {
     return callback(null, user, context);
   }

   var ManagementClient = require('auth0@2.9.1').ManagementClient;
   var management = new ManagementClient({
     token: auth0.accessToken,
     domain: auth0.domain
   });

   var params = {
       user_id: user.user_id
   };
   console.log("user object: ", user);

    management.sendEmailVerification(params, function (err) {
       if (err) {
         // Handle error.
         console.log(err);
       }
       console.log("email sent?");

       callback(null, user, context);
    });
 }

To assign email_verified on users, in Connections > Database > Login template:

assign to callback

callback(null, {
  user_id: rows[0][0].value,
  email: rows[0][1].value,
  email_verified: rows[0][3].value
});