Пример #1
0
        private void SubmitContactUsMessage(ProviderContactMessage contactMessage)
        {
            var helpdeskEmailAddress = _configurationService.Get <UserAccountConfiguration>().RecruitHelpdeskEmailAddress;
            var userEnquiryDetails   = DefaultCommunicationToken(contactMessage.Details, DefaultUserEnquiryDetails);

            var userName    = _providerReadRepository.GetByEmail(contactMessage.Email);
            var userContact = userName != null ? userName.Username : contactMessage.Email;

            _communicationService.SendMessageToProviderUser(userContact, MessageTypes.ProviderContactUsMessage, new[]
            {
                new CommunicationToken(CommunicationTokens.RecipientEmailAddress, helpdeskEmailAddress),
                new CommunicationToken(CommunicationTokens.UserEmailAddress, contactMessage.Email),
                new CommunicationToken(CommunicationTokens.UserFullName, contactMessage.Name),
                new CommunicationToken(CommunicationTokens.UserEnquiry, contactMessage.Enquiry),
                new CommunicationToken(CommunicationTokens.UserEnquiryDetails, userEnquiryDetails)
            });
        }
Пример #2
0
        public void SendEmailVerificationCode(string username)
        {
            var providerUser = _providerUserReadRepository.GetByUsername(username);

            if (providerUser == null)
            {
                throw new CustomException("Unknown username", ErrorCodes.UnknownUserError);
            }

            // ReSharper disable once RedundantArgumentDefaultValue
            providerUser.EmailVerificationCode = _codeGenerator.GenerateAlphaNumeric(EmailVerificationCodeLength);

            _providerUserWriteRepository.Update(providerUser);

            _communicationService.SendMessageToProviderUser(username, MessageTypes.SendProviderUserEmailVerificationCode,
                                                            new[]
            {
                new CommunicationToken(CommunicationTokens.ProviderUserUsername, providerUser.Username),
                new CommunicationToken(CommunicationTokens.ProviderUserEmailVerificationCode, providerUser.EmailVerificationCode)
            });
        }
        public void ResendEmailVerificationCode(string username)
        {
            var providerUser = _providerUserReadRepository.GetByUsername(username);

            if (providerUser == null)
            {
                throw new CustomException("Unknown username", ErrorCodes.UnknownUserError);
            }

            if (providerUser.Status == ProviderUserStatus.EmailVerified)
            {
                _logService.Info("Will not resend provider user email verification code, verification code is blank.");
                return;
            }

            _communicationService.SendMessageToProviderUser(username, MessageTypes.SendProviderUserEmailVerificationCode,
                                                            new[]
            {
                new CommunicationToken(CommunicationTokens.ProviderUserUsername, providerUser.Username),
                new CommunicationToken(CommunicationTokens.ProviderUserEmailVerificationCode, providerUser.EmailVerificationCode)
            });
        }