public async Task SetCacheEmailActivation(_RegisterEmail registration) { var data = registration.ToJson(); await _serverCache.SetStringAsync(registration.Email, data, new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = new TimeSpan(24, 0, 0, 0) }); await _emailRepository.SendEmailCodeAsync(registration); }
public async Task <_User> RegisterUser(_RegisterEmail userCache) { var appUser = _mapper.Map <_RegisterEmail, ApplicationUser>(userCache); appUser.Created = _calendar.LocalTime(); var userCreated = await _userManager.CreateAsync(appUser, userCache.Password); appUser = await _userManager.FindByEmailAsync(appUser.Email); var signInUser = await _signInManager.PasswordSignInAsync(appUser, userCache.Password, true, false); return(_mapper.Map <ApplicationUser, _User>(appUser)); }
public async Task SendEmailCodeAsync(_RegisterEmail registration) { var apicall = $"{host}/Account/EmailCodeVerificationBody/{registration.Email}"; HttpResponseMessage responseTask = await new HttpClient().GetAsync(apicall); Email email = new Email() { To = registration.Email, Bcc = _sender, Subject = $"Código: {registration.ValidationCode} - Activación de cuenta", Body = await responseTask.Content.ReadAsStringAsync() }; await SendMailAsync(GetMimeMessage(email)); }
public async Task <IActionResult> EmailCodeVerificationBody(string email) { _RegisterEmail emailReg = await _accountRepository.GetCacheEmailActivation(email); return(View(nameof(EmailCodeVerificationBody), emailReg.FirstName)); }