aspnet / Identity

[Archived] ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
1.96k stars 870 forks source link

ConfirmEmailAsync in UserManager does a ton of unrelated actions and validations #1856

Closed zhulien-ivanov closed 6 years ago

zhulien-ivanov commented 6 years ago

ConfirmEmailAsync in UserManager should validate a token and set the EmailConfirmed flag to true. However, in the current implementation, we save the context changes through invoking the UpdateUserAsync method. It re-sets the Normalized username and email and then calls the ValidateUserAsync method, which in turn runs the user validators. It is not that great of an overhead, but is this really necessary or is it just an architectural trade-off?

HaoK commented 6 years ago

Yeah this is the general pattern of UserManager methods that persist the user. Update is the only operation that saves the user, and it always runs the valdiation/actions you see.