InitiateRecovery()
Initiate account recovery
Description
The InitiateRecovery() method is used to initiate the recovery process for a user account. This sends an email with instructions to the affected user. If an email is shared with multiple users, the AccountRecoveryId recoveryId is a parentId that all subsequent ServiceRequestId refer too.
Package Details
Interface
IAccountRecoveryManager
Syntax
AccountRecoveryManager.Register( UserRegistrationContext registrationContext )
Returns
int
(account recovery ID)
API
[POST] /api/v1/account/initiate-recovery
email: [String] - Email address of the user who owns the account that needs to be recovered.
mbun: [String] - GCKey MBUN of the requesting GCKey user.
Issuer: [String] [Optional] - GCKey Provider of the requesting GCKey user
isEnglish: [Boolean] True if the Account Recovery email notification should be sent in English or False if it should be sent in French. By default the value is set to True
Returns
string
- Account recovery code
Example
using MTOA.BLL.Interfaces;
var gcKey = GCKeyProvider.GetKey(Request);
try
{
await _accountRecoveryManager.InitiateRecovery(AccountRecoveryEmailTemplateName, gcKey, Utility.IsEnglish(), ReturnUrl);
} catch (Exception ex) {
_logger.Error(ex, $"Error sending recovery email to: {userRegistrationViewModel.AccountRecoveryEmail}");
throw;
}