I customs Email Service and integrated with external email provider Sendgrid, and assign class "EmailService" to EmailService property via UserManager constructor
As UserManager constructor:
this.EmailService = new EmailService();
this.SmsService = new SmsService();
and Create Classes
public class EmailService : IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
public class SmsService : IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
But NO hit :(
Yes, Im using "mudule zero" template :), and there is already a UserManager class in the solution. I need Send email by UserManager.SendEmailAsync, and implment this code:
public class EmailService : IIdentityMessageService { public Task SendAsync(IdentityMessage message) { // Plug in your email service here to send an email. return configSendGridasync(message); //return Task.FromResult(0); }
now it works <a class="postlink" href="http://stackoverflow.com/questions/22629936/no-iusertokenprovider-is-registered">http://stackoverflow.com/questions/2262 ... registered</a>
UserManager.UserTokenProvider = new DataProtectorTokenProvider<User, long>(provider.Create("EmailConfirmation")) as IUserTokenProvider<User, long>; var code = await _userManager.GenerateEmailConfirmationTokenAsync(user.Id);
yes, I changed User entity and added Add-Migration ...and update-database -verbos... updated database wirh update-database -verbos... , its woriking now but get Error for this statement:
var pass = _userManager.ResetPassword(user.Id, resetToken.ToString(), new PasswordHasher().HashPassword("1q2w3e4r"));
the error is No IUserTokenProvider is registered.