Base solution for your next web application
Open Closed

Automatically select default tenant on login page #7047


User avatar
0
leonkosak created

One of our customers wants that tenant is automatically selected when a user comes to login page (because all application is "inside" tenant and not host). Users should not be aware of tenant, because they are confused. However, this customer currently does not have any options that we could "solve" this issue by URL tenant resolving ({TENANCY_NAME}).

Is somehow possible, that one tenant is selected by default (for instance "Default" tenant or any other) and if administrator wants to enter in host, he would change this on login page explicitly (write empty string in modal window on login page when changing tenant)?

Thank you.


7 Answer(s)
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, automatically tenant selection is not recommended in general. For example, show the automatically selected tenant A information to a user from tenant B might even be more confusing.

  • User Avatar
    0
    leonkosak created

    I agree, but for testing environment, we (our customer) does not have option for URL tenant subdomains. This is LOCAL INSTALLATION and only one tenant is defined (in use). There will be different in production (tenant subdomains).

  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, one possible solution is to add tenant name as query param to the application url in testing environmen. Then, implements auto tenant selection via query param in your application.

    In this case, test user will always land on tenant login page.

  • User Avatar
    0
    leonkosak created

    Crap! :( I would also need host.

  • User Avatar
    0
    ryancyq created
    Support Team

    The approach mentioned above only auto fill the tenant name when you landed on the login page.

    You can always empty the tenant name to login as host

  • User Avatar
    0
    ismcagdas created
    Support Team

    @ryancyq's suggestion is good. In that case, you can share two URLs with your customer.

    mywebsite.com?tenant=default (for tenant) mywebsite.com (for host)

  • User Avatar
    0
    leonkosak created

    Thank you. :) It works. Just two minor code additions in root-routing.module.ts and login.component.ts.

    I think that ANZ should have option resolving tenant based on URL parameters (not just via subdomains). Not all customers have abilities to provide such infrastructure.