Multi Tenant Login Without Domain!

Status
Not open for further replies.

Edward Soares

New Member
Feb 28, 2017
12
1
3
40
So I did not really like having to login with user@domain or even domain in the separate box so I modified the login page as such for use with multi tenant and it should work with single tenant also. I also did not want to populate the drop down with all the URLs and manually at that :( I did not want each client to see other's URLs. I also feel this provides more security as I edited under domains, I took the domain of my server IP and changed it to the domain of for example say voip.mypbxserverdomain.com so no one can login at the IP address for management but only that domain and no other subdomain, so this being said, I believe it provides another level of security since no one can login cross domain already.
upload_2017-2-28_18-15-0.png
The way it works is that it pulls the domain from the URL of the browser and embeds it into the hidden domain box which I hid. I give a business a URL such as theircompany.mypbxserverdomain.com and as such I installed a wildcard SSL as well. I just add the subdomain entry into my DNS server for pointing etc.

Just set domain_name_visible=TRUE under default settings.
Then modify login.php located at /var/www/fusionpbx/resources/login.php using WinSCP etc

as follows below around line 103

else {
### Edited by Edward Soares of Front Range Geeks LLC - Button Belongs below domain box but was moved above to fix spacing due to being hidden. Changed value=\"".$_SERVER['HTTP_HOST']."\" for domain box text and hidden=true to autofill domain based on url.
echo "<input type='submit' id='btn_login' class='btn' style='width: 100px; margin-top: 15px;' value='".$text['button-login']."'>\n";
echo "<input type='text' name='domain_name' class='txt login' style='text-align: center; min-width: 200px; width: 200px; margin-bottom: 8px;' hidden=true value=\"".$_SERVER['HTTP_HOST']."\" placeholder=\"".$text['label-domain']."\"><br />\n";
}
Seems more elegant to me anyway. Input is appreciated good or bad.
 
Last edited:

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,043
565
113
You do not have to log in with domain name if the URL has the domain in it.

Eg for user 100 to log in with 100, if his domain is abc.mypbx.com he visits https://abc.mypbx.com, he can now just log in with 100.
 

Edward Soares

New Member
Feb 28, 2017
12
1
3
40
When I get some time I will have to spin up a new VM of FPBX and try that out. It has never worked for me like before and forced me to do above for that behavior. And you are referring to logging into a multi tenant system in that manner? When even the official docs say username is user@domain for logging into any other domain as part of the auth process?
 

Attachments

  • IMG_0503.PNG
    IMG_0503.PNG
    292.4 KB · Views: 52
Last edited:

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,043
565
113
The docs essentially said what I said.

Essentially, if you have two clients, clientA.mypbx.com, clientB.mypbx.com it works like this:

If you are going to https://192.168.240.3 or pbx.mypbx.com or something similar then to login 100 on clientA or 100 on client B the username would need to be 100@clientA.mypbx.com and 100@clientB.mypbx.com

If you were going to https://clientA.mypbx.com then to login to 100 on clientA you would simply use 100 as the username. The domain would be taken from the URL.

You could still login 100@clientB at the above URL by using 100@clientB.mypbx.com as the username.

This has worked this way for as long as I can remember. If it doesn't, there is something badly wrong with your installation.
 
  • Like
Reactions: phonesimon

Ian Oakes

Member
Oct 14, 2016
51
9
8
43
For reference, you can also use globally unique login names, which means one user, one login - no admin on each domain anymore. To do this you go into default settings and, if its not there, create a new category called user: and add and set enabled the following:
upload_2017-12-20_14-20-56.png
 

MammerJammer

Member
Oct 23, 2018
60
5
8
48
The docs essentially said what I said.

Essentially, if you have two clients, clientA.mypbx.com, clientB.mypbx.com it works like this:

If you are going to https://192.168.240.3 or pbx.mypbx.com or something similar then to login 100 on clientA or 100 on client B the username would need to be 100@clientA.mypbx.com and 100@clientB.mypbx.com

If you were going to https://clientA.mypbx.com then to login to 100 on clientA you would simply use 100 as the username. The domain would be taken from the URL.

You could still login 100@clientB at the above URL by using 100@clientB.mypbx.com as the username.

This has worked this way for as long as I can remember. If it doesn't, there is something badly wrong with your installation.

I feel like this is worthy of a sticky.. I watched the official video which shows how to create a domain, but nothing about how to login using domain contexts. I read the documentation, I used trial and error.. Then I found Daz's post and the light went on. Makes perfect sense now.. I'm able to login with a multi-tenant user at the main IP by referencing that users domain context user@subdmn.domain.com or by navigating to https://sbdmn.domain.com and using the user name only. THANKS!
 
Status
Not open for further replies.