|
|
@ -6,6 +6,7 @@ using CustomerOnlineV2.Repository.Repository.AccountRepository; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using System.Text; |
|
|
|
using System.Web.Helpers; |
|
|
|
using static CustomerOnlineV2.Common.Models.Notification.PasswordGenerator; |
|
|
|
|
|
|
|
namespace CustomerOnlineV2.Business.Business.AccountBusiness |
|
|
@ -40,7 +41,16 @@ namespace CustomerOnlineV2.Business.Business.AccountBusiness |
|
|
|
//var randomPassword = PasswordGenerator.GenerateRandomPassword();
|
|
|
|
//model.RandomPassword = randomPassword;
|
|
|
|
|
|
|
|
var chars = "0123456789"; |
|
|
|
var random = new Random(); |
|
|
|
var result = new string(Enumerable.Repeat(chars, 6).Select(s => s[random.Next(s.Length)]).ToArray()); |
|
|
|
string random_num = result.ToString(); |
|
|
|
model.RandomPassword = random_num; |
|
|
|
|
|
|
|
List<Mapping> bodyMappings = new List<Mapping>(); |
|
|
|
bodyMappings.Add(new Mapping() { SValue = "CustomerName", SText = logindetails.FullName }); |
|
|
|
bodyMappings.Add(new Mapping() { SValue = "PASS_WORD", SText = random_num }); |
|
|
|
bodyMappings.Add(new Mapping() { SValue = "EMAIL_ID", SText = logindetails.Email }); |
|
|
|
SendNotificationRequest request = new SendNotificationRequest() |
|
|
|
{ |
|
|
|
IsBulkNotification = false, |
|
|
@ -48,13 +58,13 @@ namespace CustomerOnlineV2.Business.Business.AccountBusiness |
|
|
|
//ProcessId = processId,
|
|
|
|
ProviderId = "ResetPassword", |
|
|
|
NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(), |
|
|
|
//Template = Common.Model.Enum.NotifyTemplate.RESET_PASSWORD_EMAIL,
|
|
|
|
Template = NotifyTemplate.RESET_PASSWORD_EMAIL, |
|
|
|
Recipients = new List<RecipientViewModel>() |
|
|
|
{ |
|
|
|
new RecipientViewModel() |
|
|
|
{ |
|
|
|
NotificationContent = new NotificationDTO() { |
|
|
|
// Body = JsonConvert.SerializeObject(bodyMappings),
|
|
|
|
Body = JsonConvert.SerializeObject(bodyMappings), |
|
|
|
//Title will be set by mapping json
|
|
|
|
}, |
|
|
|
Address= model.Username |
|
|
@ -63,6 +73,9 @@ namespace CustomerOnlineV2.Business.Business.AccountBusiness |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
_logger.LogDebug("PasswordReset.EMAIL | REQUEST : " + JsonConvert.SerializeObject(request)); |
|
|
|
var jsonRx1 = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL); |
|
|
|
_logger.LogDebug("PasswordReset.EMAIL | RESPONSE : " + JsonConvert.SerializeObject(jsonRx1)); |
|
|
|
return await _accountRepo.PasswordReset(model, logindetails); |
|
|
|
} |
|
|
|
|
|
|
|