Hello,
Actually, it can be done even without any changes to Adaxes. You can configure a Business Rule triggered after self-resetting password that will send e-mail notifications depending on the type of the operation.
Since a script will be required to distinguish between the operation types, we suggest sending mails also with the help of a script. Below, you can find an example of such a script that uses the $Context.SendMail method to send the e-mails. To get more information on how to use it, see section Sending Emails and SMS in the following article from our SDK: http://www.adaxes.com/sdk/?ServerSideSc ... ailsAndSms. To send mails to the user who reset their password and/or unlocked their account, pass %mail% as the 1st parameter of the method. This is a value reference that will be replaced with the Email property of the user whose password is reset / account is unlocked when the script runs.
To create such a Business Rule:
-
Create a new Business Rule.
-
On step 2 of the Create Business Rule wizard, select User and After Self-resetting password.
-
On step 3, add the Run a program or PowerShell script action.
-
In the Script field, paste the following script. Modify the parameters of the SendMail method to match your requirements for each of the situations.
$operationName = $Context.Action.GetOperationName($NULL, $Context.TargetObject, "ADM_ACTIONNAMEFORMAT_SPECIFIC, ADM_ACTIONNAMEFORMAT_CAPITALLETTER")
if ($operationName.EndsWith("reset password, unlock account"))
{
# The user has reset a password and unlocked account
$Context.SendMail("%mail%", "Your account has been unlocked and password reset", "<BODY-TEXT>", "<BODY-HTML>") # TODO: modify me
return
}
elseif ($operationName.EndsWith("reset password"))
{
# The user has reset a password only
$Context.SendMail("%mail%", "Your password has been reset", "<BODY-TEXT>", "<BODY-HTML>") # TODO: modify me
return
}
elseif ($operationName.EndsWith("unlock account"))
{
# The user has unlocked account only
$Context.SendMail("%mail%", "Your account has been unlocked", "<BODY-TEXT>", "<BODY-HTML>") # TODO: modify me
}
-
Enter a short description for the script and click OK.
-
Finish creation of the Business Rule.
After configuring such a Business Rule, you can disable sending e-mail notifications in your Password Self-Service Policy settings as default emails will no longer be needed.