Open Closed

Request: Add IdentityDataSeedContributor.AdminUsernamePropertyName #7414


User avatar
0

We're seeing an issue when multi-tenancy is enabled and when the tenancy picker has been removed (like as in https://community.abp.io/posts/hide-the-tenant-switch-of-the-login-page-4foaup7p), specifically when creating tenants and the tenant admin is created - the default is the same username making it difficult/impossible to use without having them login using email instead.

  • ABP Framework version: v8.1.3
  • UI Type: MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes, Tiered

To reproduce:

  1. Login as non-tenant admin
  2. Create tenant, specify email and password
  3. Logout
  4. Attempt to login using admin (since that's the default username, which isn't obvious to the user creating the tenancy) and the password specified in #2

Expected: Should be able to login Actual: Can't login

Now, it does make sense but what would be nice is:

  • Allow the user making the tenancy to create a unique username (since you already allow changing that in the tenancy "set password" modal.
  • Add a IdentityDataSeedContributor.AdminUsernamePropertyName property so we can modify (Project)TenantDatabaseMigrationHandler like:
// Seed data
using (var uow = _unitOfWorkManager.Begin(requiresNew: false, isTransactional: true))
{
    await _dataSeeder.SeedAsync(
        new DataSeedContext(tenantId)
            .WithProperty(IdentityDataSeedContributor.AdminUsernamePropertyName, adminUsername) // <-- NEW
            .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, adminEmail)
            .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, adminPassword)
    );

    await uow.CompleteAsync();
}

Is that possible?


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

    Hi,

    This is a good idea, i will add it in 8.3

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    https://github.com/abpframework/abp/issues/20129

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11