Is there any built-in functionality available in ABO.IO to verify the email address by sending a verification code instead of a verification URL, Also verify the email before saved into the database. (save only if verification got successful)
I can see some functions available to verify the email by using the verification link. But which is not really works with mobile app development.
_userManager.GenerateEmailConfirmationTokenAsync(user1)
var verified = _userManager.ConfirmEmailAsync(user1, token);
The requirement is for the mobile app backend.
- ABP Framework version: v4.4.2
3 Answer(s)
-
1
hi
ChangeEmailTokenProvider
will useDataProtectorTokenProvider
to generate and verify tokens by default, https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.tokenoptions.changeemailtokenprovider?view=aspnetcore-6.0 https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.dataprotectortokenprovider-1?view=aspnetcore-6.0You can customize a token provicer to generate short digital codes. For example
PhoneNumberTokenProvider
https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.phonenumbertokenprovider-1?view=aspnetcore-6.0 https://github.com/aspnet/AspNetIdentity/blob/main/src/Microsoft.AspNet.Identity.Core/PhoneNumberTokenProvider.cs#L24Of course, you also need to change the built-in email sending and verification UI and business code.
-
0
Hi,
Thanks for the replay,
Your replay is infomative,
The
CustomEmailConfirmationTokenProvider
can be added from theConfigureServices
.public void ConfigureServices(IServiceCollection services) { services.AddIdentity<ApplicationUser, IdentityRole>(options => { options.Tokens.EmailConfirmationTokenProvider = "CustomEmailConfirmation"; }) .AddEntityFrameworkStores<AbpDbContext>() .AddDefaultTokenProviders() .AddTokenProvider <CustomEmailConfirmationTokenProvider<ApplicationUser>>("CustomEmailConfirmation"); } }
But in the case of ABP.IO the IdentityServer and related properties are is configured in the Inherited ABP module
ProjectABPModule: AbpModule { public override void OnApplicationInitialization(ApplicationInitializationContext context) { **app.UseIdentityServer();**
My question is how do I change/configure
CustomEmailConfirmationTokenProvider
from this AbpModule? -
0
hi
https://github.com/abpframework/abp/blob/48c52625f4c4df007f04d5ac6368b07411aa7521/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpIdentityAspNetCoreModule.cs#L12-L21