Open Closed

Remove email confirmation email on new user registration #5326


User avatar
0
csykes created
  • ABP Framework version: v7.0.2
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): Blazor Server Tiered
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

We have a Blazor Server application that uses Azure Active Directory OpenId for user registration and login:

When the user registers for the first time, they receive this email:

If they click the link, they are taken back to the application and an "Invalid token" error is shown:

We don't want our new users to receive this email. How can we stop it from being sent?

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    You can try this:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IAccountAppService)]
    public class MyAccountAppService : AccountAppService
    {
        public MyAccountAppService(IdentityUserManager userManager, IAccountEmailer accountEmailer, IAccountPhoneService phoneService, IIdentityRoleRepository roleRepository, IdentitySecurityLogManager identitySecurityLogManager, IBlobContainer<AccountProfilePictureContainer> accountProfilePictureContainer, ISettingManager settingManager, IOptions<IdentityOptions> identityOptions, IIdentitySecurityLogRepository securityLogRepository, IApplicationInfoAccessor applicationInfoAccessor) : base(userManager, accountEmailer, phoneService, roleRepository, identitySecurityLogManager, accountProfilePictureContainer, settingManager, identityOptions, securityLogRepository, applicationInfoAccessor)
        {
        }
    
        public override async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
        {
            await CheckSelfRegistrationAsync();
    
            if (await UseCaptchaOnRegistration())
            {
                var reCaptchaValidator = await RecaptchaValidatorFactory.CreateAsync();
                await reCaptchaValidator.ValidateAsync(input.CaptchaResponse);
            }
    
            await IdentityOptions.SetAsync();
    
            var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id);
    
            input.MapExtraPropertiesTo(user);
    
            (await UserManager.CreateAsync(user, input.Password)).CheckErrors();
            (await UserManager.AddDefaultRolesAsync(user)).CheckErrors();
    
            return ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
        }
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.