added
but navigation not worked with html5 mode true
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); }
How can I assign the ‘EmailService’ property on the UserManager to the ‘EmailService’ class Can I extend the UserManager : AbpUserManager<Tenant, Role, User> in IdentityConfig?
ex: /***************************************/ public class ApplicationRoleManager : RoleManager<IdentityRole> { public ApplicationRoleManager(IRoleStore<IdentityRole,string> roleStore) : base(roleStore) { }
public static ApplicationRoleManager Create(IdentityFactoryOptions<ApplicationRoleManager> options, IOwinContext context)
{
return new ApplicationRoleManager(new RoleStore<IdentityRole>(context.Get<ApplicationDbContext>()));
}
}
public class EmailService : IIdentityMessageService
/***********************************/
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.
I need to GenerateEmailConfirmationTokenAsync, and must implement IUserTokenProvider. I drive class UserManager : AbpUserManager<Tenant, Role, User>, IUserTokenProvider<User, long>
implememted the interface public Task<string> GenerateAsync(string purpose, UserManager<User, long> manager, User user) { Guid resetToken = Guid.NewGuid(); user.PasswordResetToken = resetToken; manager.UpdateAsync(user); return Task.FromResult<string>(resetToken.ToString()); }
public Task<bool> IsValidProviderForUserAsync(UserManager<User, long> manager, User user)
{
if (manager == null) throw new ArgumentNullException();
else
{
return Task.FromResult<bool>(manager.SupportsUserPassword);
}
}
public Task NotifyAsync(string token, UserManager<User, long> manager, User user)
{
return Task.FromResult<int>(0);
}
public Task<bool> ValidateAsync(string purpose, string token, UserManager<User, long> manager, User user)
{
return Task.FromResult<bool>(user.PasswordResetToken.ToString() == token);
}
added a property PasswordResetToken to User : AbpUser<Tenant, User>
But get Error, DbContext' context has changed since the database was created. Could you explain how to implement IUserTokenProvider, for usermanager