Within the dw.ocapi.data.customer_list.customers.afterPOST
hook you can trigger an email with a password reset token link within it. Alternatively, you could create the link and return it in a flash message or via a custom property in the response JSON.
In order to retrieve the password reset token, you'd need to call the createResetPasswordToken()
method of the dw.customer.Credentials
class instance that represents the Customer Profile's credentials. This can be retrieved in the customers.afterPOST
hook like so:
const Status = require('dw.system.Status');
function handleAfterPOST(customer, responseObj, customerListID) {
let credentials = customer.getProfile().getCredentials();
let token;
if (!empty(credentails)) {
token = credentials.createResetPasswordToken();
}
if (!empty(token)) {
// add token to response object, send an email, or something like that...
responseObj.c_reset_token = token;
return new Status(Satus.OK);
} else {
return new Status(Status.ERROR);
}
}
Of course, your hook handler would need to be registered in your hooks.json file.