Author Topic: login without domain  (Read 8266 times)

Offline tobs

  • Newbie
  • *
  • Posts: 1
login without domain
« on: June 23, 2011, 03:41:18 AM »
i just installed roundcube on my mailserver which is responsible for multiple domains.

there is just one installation, apache accepts all domains. the same roundcube can be reached by
Roundcube Webmail :: Welcome to Roundcube Webmail
Roundcube Webmail :: Welcome to Roundcube Webmail
(and quite some more...)


to allow the user to login just with his name without adding the domain-part, i just had to add few lines to the index.php.

i guess this can be improved by adding a config-variable to select "domain required", "domain not allowd", "allow both". currently a user can go to "mail.nunningen.ch" and login with his name@domain from ebp-gasser and will get his page... (which is fine for me)

i for now just strip the first part from the server_name as for me all are like 'mail.DOMAIN.TDL' and stipping the 'mail.' will be fine.

as this makes live for the user much easier, i'd like to see this in the next version as standard.


here my patch (not as attachment, just a few lines):

   $RCMAIL->kill_session();

+  $t1 = trim(get_input_value('_user', RCUBE_INPUT_POST));
+  if ( strpos($t1,'@') === false ) {
+    $t2 = $_SERVER['SERVER_NAME'];
+    $t2 = substr($t2,strpos($t2,'.')+1);
+    $t1 = $t1 . "@" .$t2;
+  }

   $auth = $RCMAIL->plugins->exec_hook('authenticate', array(
     'host' => $RCMAIL->autoselect_host(),
-   'user' => trim(get_input_value('_user', RCUBE_INPUT_POST)),
+   'user' => $t1, //ORIGINAL WAS: trim(get_input_value('_user', RCUBE_INPUT_POST)),
     'pass' => get_input_value('_pass', RCUBE_INPUT_POST, true,
        $RCMAIL->config->get('password_charset', 'ISO-8859-1')),
     'cookiecheck' => true,
     'valid' => $request_valid,
   ));



greeting from switzerland

tobias gasser

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,856
login without domain
« Reply #1 on: June 23, 2011, 10:22:52 AM »
its been available via config since 0.5
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦