Created
November 2, 2019 11:45
-
-
Save saltukalakus/7f104d0f1b4bb894a2cc694d0aef8d71 to your computer and use it in GitHub Desktop.
Welcome Sent message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
// If the connection isn't email passwordless return | |
if (context.connection !== "email") { | |
return callback(null, user, context); | |
} | |
if (user.app_metadata && user.app_metadata.welcomeSent) { | |
return callback(null, user, context); | |
} | |
// Save the welcomeSent to app_metadata | |
user.app_metadata.welcomeSent = true; | |
auth0.users.updateAppMetadata(user.user_id, user.app_metadata) | |
.then(function(){ | |
callback(null, user, context); | |
}) | |
.catch(function(err){ | |
callback(err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment