Open Closed

Extend user entity with extra property #7750


User avatar
0
imranStem created

I want to add one property passcode for user in create user and my account personal info section. I have followed below article and extra property is added in database.

https://abp.io/community/articles/identityuser-relationship-and-extending-it-xtv79mpx#:~:text=Extending%20the%20User%20Entity%20With,entity%20of%20the%20Identity%20Module.

private static void ConfigureExtraProperties()
{
    ObjectExtensionManager.Instance.Modules()
          .ConfigureIdentity(identity =>
          {
              identity.ConfigureUser(user =>
              {
                  user.AddOrUpdateProperty<string>(
                      "Passcode",
                      property =>
                      {
                          property.Attributes.Add(new StringLengthAttribute(12) { MinimumLength = 6 });
                          property.DisplayName = new FixedLocalizableString("Passcode");
                          property.Configuration[IdentityModuleExtensionConsts.ConfigurationNames.AllowUserToEdit] = true;
                      }
                  );                   

              });
          });
 }

But that property is not displaying in UI, I have angular application. Is there any configuration that I need to apply in angular application?

  • ABP Framework version: v8.1.3
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

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

    Hi,

    i can not reproduce the problem, could you share the full steps to reproduce?

    • abp new Qa7750 -u angular --old
    ObjectExtensionManager.Instance.Modules()
      .ConfigureIdentity(identity =>
      {
          identity.ConfigureUser(user =>
          {
              user.AddOrUpdateProperty<string>(
                  "Passcode",
                  property =>
                  {
                      property.Attributes.Add(new StringLengthAttribute(12) { MinimumLength = 6 });
                      property.DisplayName = new FixedLocalizableString("Passcode");
                      property.Configuration[IdentityModuleExtensionConsts.ConfigurationNames.AllowUserToEdit] = true;
                  }
              );                   
    
          });
      });
    

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09