public async Task <ForgotPasswordResponseViewModel> ForgotPassword([FromBody] ForgotPasswordFormDataViewModel model) { if (ModelState.IsValid) { try { var hostName = GetHostName(); var queryResult = await _querySender.Send(new UserSearchQuery { Email = model.Email, ChannelId = Channels.Feel, SignUpMethodId = SignUpMethods.Regular, }); if (queryResult.Success) { Messaging.Models.Emails.Email email = new Messaging.Models.Emails.Email(); email.To = model.Email; email.From = "FeelitLIVE <*****@*****.**>"; email.TemplateName = "FeelResetPassword"; email.Variables = new Dictionary <string, object> { ["passwordresetlink"] = "<a href='https://" + hostName + "/reset-password?" + queryResult.User.AltId.ToString() + "'><img src='https://static1.feelitlive.com/images/feel-mail/choose-password.png' width='231' height='36px' style='border:0' alt='Choose A New Password' /></a>", }; await _accountEmailSender.Send(email); return(new ForgotPasswordResponseViewModel { Success = true, IsExisting = true, }); } else { return(new ForgotPasswordResponseViewModel { Success = true, IsExisting = false, }); } } catch (Exception ex) { _logger.Log(Logging.Enums.LogCategory.Error, ex); return(new ForgotPasswordResponseViewModel { Success = false, IsExisting = false, }); } } else { return(new ForgotPasswordResponseViewModel { Success = false, IsExisting = false, }); } }
public async Task <EventDetailsViewModel> SaveEventDetail([FromBody] EventDetailsViewModel model) { if (ModelState.IsValid) { try { var session = await _sessionProvider.Get(); EventDetailsCommandResult eventDetailsCommandResult = await _commandSender.Send <EventDetailsCommand, EventDetailsCommandResult>(new EventDetailsCommand { EventDetail = model.EventDetail, CurrentStep = model.CurrentStep, ModifiedBy = session.User != null ? session.User.AltId : Guid.Parse("7390283B-4A32-4860-BA3D-B57F1E5F2DAC"), }); if (eventDetailsCommandResult.Success) { if (model.EventDetail.EventId == 0 && !FIL.Contracts.Utils.Constant.TestEmail.TestEmails.Contains(session.User.Email) && !_httpContextAccessor.HttpContext.Request.Host.Host.Contains("localhost") && !_httpContextAccessor.HttpContext.Request.Host.Host.Contains("dev") ) { Messaging.Models.Emails.Email email = new Messaging.Models.Emails.Email(); email.To = "*****@*****.**"; email.From = "FeelitLIVE <*****@*****.**>"; email.TemplateName = "FILCreateEventAlertToCorp"; email.Variables = new Dictionary <string, object> { ["eventname"] = eventDetailsCommandResult.EventDetail.Name, ["creatorname"] = session.User.FirstName + " " + session.User.LastName, ["eventlink"] = "https://admin.feelitlive.com/host-online/" + eventDetailsCommandResult.EventDetail.EventId + "/basics", }; await _accountEmailSender.Send(email); } // add user to mailChimp contacts try { var query = await _querySender.Send(new UserSearchQuery { Email = session.User.Email, ChannelId = Channels.Feel, SignUpMethodId = SignUpMethods.Regular, }); await _mailChimpProvider.AddFILMember(new MCUserModel { FirstName = session.User.FirstName, LastName = session.User.LastName, Email = session.User.Email, PhoneCode = session.User.PhoneCode, PhoneNumber = session.User.PhoneNumber, IsCreator = true, SignUpType = "Regular" }, query.Country); } catch (Exception e) { _logger.Log(Logging.Enums.LogCategory.Error, e); } return(new EventDetailsViewModel { Success = true, EventDetail = eventDetailsCommandResult.EventDetail, CurrentStep = eventDetailsCommandResult.CurrentStep, CompletedStep = eventDetailsCommandResult.CompletedStep }); } else { return(new EventDetailsViewModel { }); } } catch (Exception e) { return(new EventDetailsViewModel { }); } } else { return(new EventDetailsViewModel { }); } }
public async Task <RegistrationResponseViewModel> Register([FromBody] RegistrationFormDataViewModel model) { if (ModelState.IsValid) { var hostName = GetHostName(); var passwordHasher = new PasswordHasher <string>(); try { var queryResult = await _querySender.Send(new UserSearchQuery { Email = model.Email, ChannelId = Channels.Feel, SignUpMethodId = SignUpMethods.Regular, PhoneCode = model.PhoneCode }); if (queryResult.Success) { return(new RegistrationResponseViewModel { Success = false, IsExisting = true, }); } else { await _commandSender.Send(new RegisterUserCommand { Email = model.Email, PasswordHash = passwordHasher.HashPassword(model.Email, model.Password), UserName = model.UserName, FirstName = model.FirstName, LastName = model.LastName, ChannelId = Channels.Feel, SignUpMethodId = SignUpMethods.Regular, PhoneCode = model.PhoneCode, PhoneNumber = model.PhoneNumber, Ip = _clientIpProvider.Get(), ReferralId = model.ReferralId, IsMailOpt = model.IsMailOpt }); var query = await _querySender.Send(new UserSearchQuery { Email = model.Email, ChannelId = Channels.Feel, SignUpMethodId = SignUpMethods.Regular, PhoneCode = model.PhoneCode }); Messaging.Models.Emails.Email email = new Messaging.Models.Emails.Email(); email.To = model.Email; email.From = "FeelitLIVE <*****@*****.**>"; // XXX: TODO: Add feel email template email.TemplateName = "feelUserSignUp"; email.ConfigurationSetName = "FIL-Signup"; email.Variables = new Dictionary <string, object> { ["activationurl"] = "<a href='https://" + hostName + "/activate/" + query.User.AltId.ToString() + "' style='margin -right:100px;'><img src='https://static1.feelitlive.com/images/feel-mail/activate-account.png' width='215' height='36' style='border:0' alt='Activate Your Account' /></a>", ["sitename"] = "feelitLIVE" }; await _confirmationEmailSender.Send(email); // adding user to MailChimp contacts try { await _mailChimpProvider.AddFILMember(new MCUserModel { FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, PhoneCode = model.PhoneCode, PhoneNumber = model.PhoneNumber, IsCreator = false, SignUpType = "Regular" }, query.Country); } catch (Exception e) { _logger.Log(Logging.Enums.LogCategory.Error, e); } return(new RegistrationResponseViewModel { Success = true, IsExisting = false, }); } } catch (Exception ex) { _logger.Log(Logging.Enums.LogCategory.Error, ex); return(new RegistrationResponseViewModel { Success = false, IsExisting = false, }); } } else { return(new RegistrationResponseViewModel { Success = false, IsExisting = false, }); } }