This is a problem with the bundle config that does not minify the customization files: https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Mvc/bundleconfig.json
You need to bundle the base on as well as all the all the themes:
{
"outputFileName": "wwwroot/Common/Styles/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/default/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/default/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/blue/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/blue/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/green/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/green/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/pink/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/pink/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/yellow/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/yellow/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/theme2/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/theme2/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/theme3/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/theme3/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/theme7/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/theme7/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/theme8/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/theme8/metronic-customize.css"
]
},
{
"outputFileName": "wwwroot/Common/Styles/Themes/theme11/metronic-customize.min.css",
"inputFiles": [
"wwwroot/Common/Styles/Themes/theme11/metronic-customize.css"
]
}
And also remove the main customzation from the common-styles.css
bundle at the top:
{
"outputFileName": "wwwroot/view-resources/Areas/App/Views/_Bundles/common-styles.css",
"inputFiles": [
"wwwroot/Common/Styles/**/*.css",
"wwwroot/fonts/fonts-poppins.css",
"wwwroot/fonts/fonts-roboto.css",
"!wwwroot/Common/Styles/**/*.min.css",
"!wwwroot/Common/Styles/Themes/**/*.css",
"!wwwroot/Common/Styles/abp-zero-template-rtl.css",
+ "!wwwroot/Common/Styles/metronic-customize.css*.css",
"!wwwroot/Common/Styles/metronic-customize-top-menu*.css"
]
},
That just leaves the JS error "Invalid dimensions for plot" on the dashboard to try and resolve.
This is the same problem as seen here: https://support.aspnetzero.com/QA/Questions/6194#answer-f37480ee-3374-e2de-e53f-39eb1a9bcef4
Minified versions of these files don't exist and are not created as part of a production build. Some of the theme files are not empty so you should not remove them.
Figured out you need to set the Abp.TenantId
header: https://support.aspnetzero.com/QA/Questions/6269
OK, I cannot seem to register users if they pass in the tenant ID.
CurrentUnitOfWork.SetTenantId(model.TenantId);
var user = await _userRegistrationManager.RegisterAsync(
model.Name,
model.Surname,
model.EmailAddress,
model.PhoneNumber,
model.Password,
false,
_appUrlService.CreateEmailActivationUrlFormat(model.TenantId)
);
user.PhoneNumber = model.PhoneNumber;
user.ShouldChangePasswordOnNextLogin = false;
await CurrentUnitOfWork.SaveChangesAsync();
I rexpected the above to work, but instead I get an exception saying "InvalidOperationException: Can not register host users!".
CheckForTenant()
in UserRegistrationManager
only checks the session, not the unit of work and since this value cannot be set, how do I set in in an unauthorized Register call?
I just finished it up now. Was a little tricky to get it right but your advice did help put on the right track as to what I needed to do. Tested everything works in terms of logging in even with the wrong cookie and impersonation.
Was confused about the logins being created but made some other tweaks there to identify tenant admins a bit better so that I could use phone number user names (off-topic). For anyone else reading, those users are also required for unit tests so don't just remove that code.
Figured out why the admin users get created, this is because if a user with "admin" does not exist then one is created for you. This happens in TenantRoleAndUserBuilder.cs
inside CreateRolesAndUsers
. during startup.
More users are created automatically in HostRoleAndUserCreator.cs
inside CreateHostRoleAndUsers
, also removed this to avoid it.
Disabling the filters works but the the login fails with an error like "USERNAME already exists". I updated all usernames in the database to match the email address and modified registration to save the email address as username with validation etc.
When logging in with an updated user, a duplicate user is added to the database somehow with the username "admin" again, and the issue above happens all over again. [email protected] is also added to the database again even though the original user details were modified now having two admins for each tenant.
Everything else seems to work well, appending null to the tenant cookie fails so tehre is a bug there and you should rather call .Delete
.
How do you prevent these new admin users from being generated?