Open Closed

Trying to extend the new account registration #650


User avatar
0
Femi.madariola created

When an account is registered, I want the user's first name and last name to be amongst the information that is collected.

When registering a new account, only the email address, username, password and appname are collected. The implication is that new users that register don't have a first name and last name at the point of registration.

Hence, I want to extend the api/account/register to accept a First name and Last name. { "userName": "string", "emailAddress": "user@example.com", "password": "string", "appName": "string", "returnUrl": "string", "returnUrlHash": "string", "captchaResponse": "string" }

How do I go about this and also what is the "appName" property?


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

    HI,

    AppName is your front-end type, can be web, ios, angular.... . It can also be any value.

    You can create a new appservices like:

    [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) : base(userManager, accountEmailer, phoneService, roleRepository, identitySecurityLogManager, accountProfilePictureContainer, settingManager, identityOptions)
        {
        }
    
        public async Task<IdentityUserDto> MyRegisterAsync(MyRegisterDto input)
        {
            var result =await base.RegisterAsync(new RegisterDto() {....});
    
            var user = await UserManager.FindByIdAsync(result.Id.ToString());
    
            user.Surname = input.SurName;
                .....
    
            await UserManager.UpdateAsync(user);
        }
    }
    
  • User Avatar
    0
    Femi.madariola created

    Thanks for your response.

    For the AppName: When I put in any value (i.e. I used "Mp_App"), I got the error below:

    Volo.Abp.AbpException: Url, named 'Abp.Account.EmailConfirmation', for the application 'MP_App' was not configured. Use AppUrlOptions to configure it! at Volo.Abp.UI.Navigation.Urls.AppUrlProvider.GetConfiguredUrl(String appName, String urlName) at Volo.Abp.UI.Navigation.Urls.AppUrlProvider.GetUrlAsync(String appName, String urlName)

    What do I do?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Try:

    Configure<AppUrlOptions>(options =>
    {
        options.Applications["Mp_App"].RootUrl = your url....;
    });
    
  • User Avatar
    0
    lataing created

    HI,

    AppName is your front-end type, can be web, ios, angular.... . It can also be any value.

    You can create a new appservices like:

    [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) : base(userManager, accountEmailer, phoneService, roleRepository, identitySecurityLogManager, accountProfilePictureContainer, settingManager, identityOptions) 
        { 
        } 
     
        public async Task<IdentityUserDto> MyRegisterAsync(MyRegisterDto input) 
        { 
            var result =await base.RegisterAsync(new RegisterDto() {....}); 
     
            var user = await UserManager.FindByIdAsync(result.Id.ToString()); 
     
            user.Surname = input.SurName; 
                ..... 
     
            await UserManager.UpdateAsync(user); 
        } 
    } 
    

    I can't refer to myregisteraasync because the iaccountappservice interface doesn't have it. I can't refer to the myregisteraasync method.

    What should I do?

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15