Files
Aaru.Server/Aaru.Server.New/Components/Account/IdentityNoOpEmailSender.cs

25 lines
1.3 KiB
C#
Raw Normal View History

2024-05-02 07:43:47 +01:00
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI.Services;
namespace Aaru.Server.New.Components.Account;
// Remove the "else if (EmailSender is IdentityNoOpEmailSender)" block from RegisterConfirmation.razor after updating with a real implementation.
sealed class IdentityNoOpEmailSender : IEmailSender<IdentityUser>
2024-05-02 07:43:47 +01:00
{
2024-05-03 03:24:40 +01:00
readonly IEmailSender emailSender = new NoOpEmailSender();
2024-05-02 07:43:47 +01:00
public Task SendConfirmationLinkAsync(IdentityUser user, string email, string confirmationLink) =>
2024-05-02 07:43:47 +01:00
emailSender.SendEmailAsync(email,
"Confirm your email",
$"Please confirm your account by <a href='{confirmationLink}'>clicking here</a>.");
public Task SendPasswordResetLinkAsync(IdentityUser user, string email, string resetLink) =>
2024-05-02 07:43:47 +01:00
emailSender.SendEmailAsync(email,
"Reset your password",
$"Please reset your password by <a href='{resetLink}'>clicking here</a>.");
public Task SendPasswordResetCodeAsync(IdentityUser user, string email, string resetCode) =>
2024-05-02 07:43:47 +01:00
emailSender.SendEmailAsync(email,
"Reset your password",
$"Please reset your password using the following code: {resetCode}");
}