everything works now
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-05-19 23:14:57 +02:00
parent 0b01340e88
commit beab15a7ef
10 changed files with 168 additions and 32 deletions

View File

@ -0,0 +1,35 @@
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
namespace HanyadikHetVan.Infrastructure
{
public class EmailSender : IEmailSender
{
private readonly EmailSenderConfig _emailsenderconfig;
public EmailSender(IOptions<EmailSenderConfig> emailsenderconfig)
{
_emailsenderconfig = emailsenderconfig.Value;
}
public Task SendEmailAsync(string email, string subject, string htmlMessage)
{
var client = new SmtpClient(_emailsenderconfig.Host, _emailsenderconfig.Port)
{
UseDefaultCredentials = false,
EnableSsl = false
};
return client.SendMailAsync(
new MailMessage(_emailsenderconfig.UserName, email, subject, htmlMessage) { IsBodyHtml = true }
);
}
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace HanyadikHetVan.Infrastructure
{
public class EmailSenderConfig
{
public string Host { get; set; }
public int Port { get; set; }
public string UserName { get; set; }
}
}

View File

@ -2,6 +2,8 @@
using IdentityServer4.Models;
using IdentityServer4.Services;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
@ -11,10 +13,12 @@ namespace HanyadikHetVan.Infrastructure
public class ProfileService : IProfileService
{
private readonly UserManager<User> userManager;
private readonly ILogger<ProfileService> _logger;
public ProfileService(UserManager<User> userManager)
public ProfileService(UserManager<User> userManager, ILogger<ProfileService> logger)
{
this.userManager = userManager;
this._logger = logger;
}
public async Task GetProfileDataAsync(ProfileDataRequestContext context)