Remove Admin Block after Password Reset
Last Updated:
Overview
A use case may involve placing an admin block on certain users until they reset their password.
Applies To
- Blocked Admin
- Password Reset
Solution
Unblocking a user after a password change can be implemented with a PostChangePassword action using ManagementClient, action would look similar to below:
exports.onExecutePostChangePassword = async (event, api) => {
const ManagementClient = require('auth0').ManagementClient;
const management = new ManagementClient({
domain: "{auth0 domain}",
clientId: "{your m2m application clientId}",
clientSecret: "{your m2m application secret}",
});
const user_id = { id : event.user.user_id};
const data = { "blocked" : false};
await management.users.update(user_id, data)
};
//Please be sure to add dependency in Action Node modules as "auth0" latest