Exemple #1
0
        public async Task <ActionResult> SendEmailConfirmation(string userName)
        {
            string userId = await _userDataService.GetIdByUserName(userName);

            UserDTO user = await _userDataService.GetUserInfo(userId);

            string code = await _mailingService.GenerateEmailToken(user);

            var url = Url.Action("ConfirmEmail", "Email", new
            {
                area   = "User",
                userId = user.Id,
                code   = code
            }, protocol: Request.Url.Scheme);
            await _mailingService.SendEmailAsync(user.Id, "TestingSystem", $"<a href='{url}'>Confirm email with this link</a>");

            return(View("ConfirmEmail"));
        }