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.

hi @david do you know if this was ever fixed? I have the same issue with multi companies and logo’s of the first company showing on ALL of the other client pages. eventhough the company_key is different for each?

@para

Are you using the ?company_key= in the URL

Hi David, yes I am.

Each company_key is unique and can see them in URL. (examples below)

https://in.example.com/client/login?company_key=4JHKX6dbpTybmAzJAfcIeardJn3WObzQ
https://in.example.com/client/login?company_key=v7qCiuYs9gikDQhHXp4Qgr3BmLV2C7js
https://in.example.com/client/login?company_key= UoXBw5zaFoXdlNo4efDt41woflgR7yZm
https://in.example.com/client/login?company_key= p6nLOJ9srYzMOUdFBBa30L8xi57jacFM

BUT all of them display the same company logo.Inspect source shows

https://in.example.com/storage/4JHKX6dbpTybmAzJAfcIeardJn3WObzQ/GtUfGzXQ3cxzTtAbUa5jsK5HVhsIZWYmz0e265Q7.png

Not sure if I am making sense here. But it did work, just not sure when it last worked. Had a client call me and ask who this random company is when they check invoices.

You are making complete sense.

The internal app docs are not showing the correct format:

http://domain.com/client/login/XXXXXXXXXXXXXXXXXXXXXXXX

it isn’t a query parameter, it is just part of the URI.

We’ll update the examples in the app…

Thanks David, anything I can do to fix this?

if you use the format as above this should resolve the issue

1 Like

Thanks, just tested it that way and it worked. Ill see where I can update this.

Currently this is set in settings.