Hi,
Is there an easy way to bypass the initial tenant selection?
I dont want to use subdomain structure either.
I have multi tenant enabled but they are all in the same db, so I want to set the first tenant as default tenant for the logged in user without having him select a tenant initially.
Any pointers will be greatly appreciated.
thank you
7 Answer(s)
-
0
Hi @uenlkr4e
You can configure this to use different databases for tenants, and you need to set this up when creating the tenant. If you want to specify a default tenant for a user who logs in, you can set the TenantId to a default tenant when the user registers.
-
0
This isnt exactly what i need.
I want to keep all tenants in the same db but i dont want a user to select his tenant before the login operation.
isnt this possible?system will find users default tenant at the time of the login and run with that tenant.
I understand that selecting a tenant before login makes sense if tenants use different databases but for me this isnt the case. and my users are asking "why do i have to select a tenant before login, cant i just login".
there has to be a way to make it easily possible but i dont know where.
thank you
-
0
Hi @uenlkr4e
You can implement this scenario as follows: In multi-tenancy enabled applications, users other than the host users require a tenant. Therefore, for users who do not want to select a tenant, you can create a separate login page or remove the tenant selection part from the current login page. Then, you can manually set a default tenant for the user logging in. This way, you will hide the tenant structure, allowing the user to log into the application without selecting a tenant.
-
0
Hi,
Where do i manually set the default tenant for the user?
The code there is fairly complex and I dont want to ruin something while setting a tenant manually in the wrong place.thanks
-
0
Hi @uenlkr4e
To better assist you, is your project using Angular UI or MVC UI?
-
0
angular ui
-
0
Hi @uenlkr4e
You need to make changes to the save function in the tenant-change-modal component. You can set the tenant information using the abp.multiTenancy.setTenantIdCookie() method. When a user registers or logs in, the tenant information is retrieved from AbpSession and processed accordingly.
While modifying the save function, keep in mind that the tenant information should be set to null for the host user. To handle this distinction, you can use a separate page for the host user or modify the existing page so that during tenant selection, it only allows tenant or host switching without requiring the tenant name information.