Track vscode setup

This commit is contained in:
Paul Schneider
2025-03-02 16:53:36 +00:00
parent 204bb80252
commit c351d71129
7 changed files with 279 additions and 199 deletions

View File

@ -8,29 +8,40 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MimeKit;
using Yavsc.Abstract.Manage;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Identity;
using Yavsc.Interface;
using Yavsc.Settings;
using Yavsc.Models;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.Extensions.Localization;
using System.Web;
namespace Yavsc.Services
{
public class MailSender : IEmailSender, ITrueEmailSender
public class MailSender : IEmailSender<ApplicationUser>, IEmailSender, ITrueEmailSender
{
private readonly IStringLocalizer<YavscLocalization> localizer;
readonly SiteSettings siteSettings;
readonly SmtpSettings smtpSettings;
private readonly ILogger logger;
public MailSender(
IOptions<SiteSettings> sitesOptions,
IOptions<SmtpSettings> smtpOptions,
ILoggerFactory loggerFactory
ILoggerFactory loggerFactory,
IStringLocalizer<Yavsc.YavscLocalization> localizer
)
{
this.localizer = localizer;
siteSettings = sitesOptions.Value;
smtpSettings = smtpOptions.Value;
logger = loggerFactory.CreateLogger<MailSender>();
}
public Task SendConfirmationLinkAsync(ApplicationUser user, string email, string confirmationLink)
{
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
@ -40,7 +51,7 @@ namespace Yavsc.Services
/// <returns>a MessageWithPayloadResponse,
/// <c>bool somethingsent = (response.failure == 0 &amp;&amp; response.success > 0)</c>
/// </returns>
public async Task SendEmailAsync(string email, string subject, string htmlMessage)
{
@ -79,5 +90,25 @@ namespace Yavsc.Services
}
return msg.MessageId;
}
public async Task SendPasswordResetCodeAsync(ApplicationUser user, string email, string resetCode)
{
var callbackUrl = siteSettings.Audience + "/Account/ResetPassword/" +
HttpUtility.UrlEncode(user.Id) + "/" + HttpUtility.UrlEncode(resetCode);
await SendEmailAsync(user.UserName, user.Email,
localizer["Reset Password"],
localizer["Please reset your password by "] + " <a href=\"" +
callbackUrl + "\" >following this link</a>");
throw new NotImplementedException();
}
public async Task SendPasswordResetLinkAsync(ApplicationUser user, string email, string resetLink)
{
await SendEmailAsync(user.UserName, user.Email,
localizer["Reset Password"],
localizer["Please reset your password by "] + " <a href=\"" +
resetLink + "\" >following this link</a>");
}
}
}