+ Reply to Thread
Results 1 to 6 of 6

Thread: Simple multiple domains login

  1. #1
    chaky is offline Registered User
    Join Date
    Mar 2009
    Posts
    2
    Downloads
    0
    Uploads
    0

    Lightbulb Simple multiple domains login

    I have server with about 30 mail domains on it.
    I wanted my users to use simple logins, not the FQDN ones.
    In earlier versions I had to edit some core functionality to allow that, but with plugin API introduction, it became very easy.
    So, I share my solution with community. Hope that helps someone.

    1) All domains should have the same subdomain for webmail page address.
    My ones look like mail.domain.com, mail.domain1.com and so on.
    This is because the domain part being extracted from the page URL. If you want to use another subdomain, or don't use subdomain at all - open the domain_login.php file, find the string
    Code:
    $dhost = substr($_SERVER['HTTP_HOST'],5);
    and change the 5 ("mail.") to your subdomain's length + 1 (for dot)
    So, if no subdomain is used, change it to
    Code:
    $dhost = $_SERVER['HTTP_HOST'];
    2) In Apache virtual host configuration for RoundCube webmail page you should have something like:
    Code:
    ServerName mail.domain.com
    ServerAlias mail.domain1.com
    ServerAlias mail.domain2.com
    And so on. Don't forget to add ServerAlias directive for every your new domain.
    3) Download the attached file and unzip to the plugins/ directory
    4) Edit your config/main.inc.php file to enable the plugin called 'domain_login'
    Code:
    $rcmail_config['plugins'] = array('domain_login');
    When plugin enabled, user can visit the page http://mail.domain.com and enter his localpart login - the domain part is extracted from the page URL and added to user's login to form the FQDN login, which is used to authenticate. Plugin checks for the "@" symbol in user's login, so if the FQDN login was entered then nothing will be added - thus plugin doesn't brake the FQDN-style authentication for those who doesn't need short logins.

    P.S. RoundCube rocks!
    Attached Files

  2. #2
    skaero's Avatar
    skaero is offline Administrator
    Join Date
    Jun 2006
    Location
    USA - New Mexico
    Posts
    2,092
    Downloads
    5
    Uploads
    0

    Default

    Nice! I was thinking about doing something like this myself, you saved me the time!

  3. #3
    leo85 is offline Roundcube Newcomer
    Join Date
    Dec 2009
    Posts
    2
    Downloads
    1
    Uploads
    0

    Default

    Quote Originally Posted by chaky View Post
    2) In Apache virtual host configuration for RoundCube webmail page you should have something like:
    Code:
    ServerName mail.domain.com
    ServerAlias mail.domain1.com
    ServerAlias mail.domain2.com
    Where exactly is this page? Sorry, I'm new to this.

    This is just what I was looking for, thanks.

  4. #4
    jmorrow is offline Roundcube Newcomer
    Join Date
    Dec 2009
    Posts
    3
    Downloads
    3
    Uploads
    0

    Default

    The aliases he speaks of are in your webserver configuration...

  5. #5
    jmorrow is offline Roundcube Newcomer
    Join Date
    Dec 2009
    Posts
    3
    Downloads
    3
    Uploads
    0

    Cool Enhancement To Plugin

    Last night I wrote a simple enhancement to this login in plugin. In my version instead of trimming the url from the front you specify the number of domain elements you want, i.e. if you specify 2 (the default) elements www.testdomain.com and webmail.testdomain2.com would be cut to testdomain.com and test2domain.com respectively.

    The nice thing about this is the subdomain of different sites can be different and the plugin still handles it correctly.

    In addition to this I changed the plugin so when a user specifies there whole email address it verifies the domain part matches the current url. THis prevents a user from going to domain1 ones webmail screen and logging in with a domain2 email address.

    The install is exactly the same as above. Hope this helps someone.
    Attached Files

  6. #6
    skaero's Avatar
    skaero is offline Administrator
    Join Date
    Jun 2006
    Location
    USA - New Mexico
    Posts
    2,092
    Downloads
    5
    Uploads
    0

    Default

    Nice upgrade! I like the verification the domain good security, Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts