Exemple #1
0
        public void SendConfirmation(string emailValue, ConfirmationCodeType type)
        {
            var code = _codeGenerator.GenerateCode(type);

            var email = _emailManager.GetEmailByValue(emailValue);

            if (email == null)
            {
                throw new EmailNotFoundException(emailValue);
            }

            _codeManager.SaveCode(code, email);

            _notificationTransportService.SendNotification("", "");
        }
        public void SendConfirmation(string emailValue, ConfirmationCodeType type)
        {
            var code = _codeGenerator.GenerateCode(type);

            var email = _emailManager.GetEmailByValue(emailValue);

            if (email == null)
            {
                throw new EmailNotFoundException(emailValue);
            }

            string linkType;

            _codeManager.SaveCode(code, email);

            if (type == ConfirmationCodeType.EmailChange)
            {
                linkType = "/email-change/";
            }
            else if (type == ConfirmationCodeType.EmailChangeConfirmation)
            {
                linkType = "/email-change-confirm/";
            }
            else if (type == ConfirmationCodeType.EmailConfirmation)
            {
                linkType = "/email-confirm/";
            }
            else
            {
                linkType = "/password-recover/";
            }


            var linkWithCode = clientUrl + linkType + code.Value;

            _notificationTransportService.SendNotification(emailValue, linkWithCode);
        }