-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Make IEmailSender more easily customizable #50298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
API Review Notes:
API Approved! // Microsoft.AspNetCore.Identity.dll (the move to the shared framework only assembly allows DIMs in the future)
namespace Microsoft.AspNetCore.Identity;
public interface IEmailSender<TUser> where TUser : class
{
// Used by MapIdentityApi and Identity UI
Task SendConfirmationLinkAsync(TUser user, string email, string confirmationLink);
// Used by Identity UI
Task SendPasswordResetLinkAsync(TUser user, string email, string resetLink);
// Used by MapIdentityApi since it does not provide a UI to enter the new password into. That's left to custom application code.
Task SendPasswordResetCodeAsync(TUser user, string email, string resetCode);
} |
I'd like an optional "CallbackUrl" since I'll likely have multiple frontends using the same Auth API. If you want to see how I implemented RC1: https://youtu.be/yGYpN1hFPAg?si=SDyUdQdtUSfDHPO9 |
@augustevn Please create new issue(s) using one of the templates rather than comment on old/closed issues/pull requests. |
I did create an API proposal: Identity API Optional CallbackUrl But I keep getting flabbergasted by this API, what is this method for? The code comments don't clarify the intent. |
Background and Motivation
Originally posted by @halter73 in #49981 (comment)
We now also have a customer requesting this functionality in the preview7 blogpost at https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-7/comment-page-2/#comment-18682
Proposed API
Usage Examples
MyEmailSender.cs
Program.cs
Alternative Designs
subject
andhtmlMessage
to figure out what kind of email is being sent and try to extract any links or password reset codes.TUser user
parameters since it's unneeded by the default implementation, but it seems like it could be useful and it is not difficult to pass in.Risks
In the future, we might not need to send these exact kinds of emails. Maybe the code in Identity UI or
MapIdentityApi
will have the need to specify more parameters than just the recipient and email confirmation link. In that case, we'd probably add more DIMs, but it would be less clear which ones are actually used.The text was updated successfully, but these errors were encountered: