Open Closed

Need to customize the register process to use existing user id instead to generate new one (user id) for the new user #8270


User avatar
0
mks1704@hotmail.com created
  • ABP Framework version: v8.1.0
  • UI Type: MVC
    • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: none
  • Steps to reproduce the issue: How I can replace the new user id with the existing one while registering new user which was hard deleted but stored in temporary table for later use. I mean the register process should not create new user id rather it should use what I will pass to it.

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

    Hi,

    you can override the register model.

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(RegisterModel))]
    public class MyRegisterModel : RegisterModel
    {
        public MyRegisterModel(
            IAuthenticationSchemeProvider schemeProvider, 
            IOptions<AbpAccountOptions> accountOptions, 
            IAccountExternalProviderAppService accountExternalProviderAppService,
            ICurrentPrincipalAccessor currentPrincipalAccessor,
            IHttpClientFactory httpClientFactory) : base(schemeProvider, accountOptions, accountExternalProviderAppService, currentPrincipalAccessor, httpClientFactory)
        {
        }
    
        protected override Task<IdentityUser> RegisterLocalUserAsync()
        {
            //.....
        }
    
        protected override Task<IdentityUser> RegisterExternalUserAsync(ExternalLoginInfo externalLoginInfo, string userName, string emailAddress)
        {
            //.....
        }
    }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11