コード例 #1
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)
            });
        }
コード例 #2
0
 public ProviderUser UpdateProviderUser(ProviderUser providerUser)
 {
     //Check if email is being updated and set pending, verification code, send email etc
     return(_providerUserWriteRepository.Update(providerUser));
 }