Client portal branding with multi company

we have 5 companies on our self hosted v5, when hitting the route /client/login on the main domain, our clients see the “client portal” with the logo from the 1st company in our list of 5

two questions

  1. how can i set it so company 3 of 5 in my list of companies is the default not company 1 of 5
  2. is there a way to have a portal for each company that shows the correct brand?

solved question 1: i saw how in account management we had the option to set default company, clicked it and i now see company 3 logo on portal.

still curious about question 2 though.

Found this: Possible to change domain when changing companies?

Additional clarification on why it is not possible can be found in the GitHub issue: Multi Domain setup for different companies in one single installation (self-hosted / v5) · Issue #8642 · invoiceninja/invoiceninja · GitHub

thanks @juwillsee but i am not asking about separate admin domains per company, rather separate client portal urls that show seperate branding.

I already have the domain url setup on each brand, and each url resolves to the host that powers invoice ninja. but what is not happening is the client portal showing the logo for the correct company.

@david do you have any suggestions?

Sorry, I misunderstood you there.

it is possible to show the correct logo for multi company configurations, if you append the company_key (companies.company_key from the db) to the end of the login url…

ie…

https://yourdomain.com/client/login/companies.company_key

that helps a bit, but that does not help when the user clicks a link in their email to pay online, right? because when i test i see the one logo and not the logo relative to the email with a link to pay online.

I’ve run into this issue as well.

I’ve configured in the DB according to the last post in this github issue: Different Domain URL for Multi-Company Client Portals on same IN install · Issue #7364 · invoiceninja/invoiceninja · GitHub

I discovered by digging in the code that in order for the company_key to be set by the domain_db middleware you need to enable MULTI_DB_ENABLED=true in .env

Then the domain_db middleware will be able to set the correct company_key in the session.

BUT the client portal still loads the default company’s info.

I haven’t dug in too deep but I suspect there’s some kind of issue with the client portal script not pulling in or using the company_key at the correct time in the script.

I’m going to spend some more time with it today.

Update: I found the bug.

In app/Http/Controllers/Auth/ContactLoginController.php on line 46 reads:

$company = Company::where('company_key', $request->input('company_key'))->first();

It should be:

$company = Company::where('company_key', $request->session()->get('company_key'))->first();

Now the client login screen shows the appropriate branding for me based on domain name.

@hillel and @david

1 Like

@xisonc

Thanks i’ll get a fix in for this.