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.
|
2024-05-03 22:54:50 +01:00
|
|
|
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
|
|
|
|
2024-05-03 22:54:50 +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>.");
|
|
|
|
|
|
2024-05-03 22:54:50 +01:00
|
|
|
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>.");
|
|
|
|
|
|
2024-05-03 22:54:50 +01:00
|
|
|
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}");
|
|
|
|
|
}
|