Author Topic: Username Domain Drop-Down Menu.  (Read 4447 times)

Offline Jaffa

  • Newbie
  • *
  • Posts: 2
Username Domain Drop-Down Menu.
« on: April 10, 2007, 07:51:14 AM »
I am trying to get a list on the login page for the domain. You see the server is localhost so there are no problems with that, but then people have to login using username@domain.com and I would like to set it up so they just have to put in their username and then select the domain from a pop-up menu. I have tried doing this but it does not seem to work:

Code: [Select]
// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['username_domain'] = array('localhost' => 'domain1.net', 'localhost' => 'domain2.com.au');

Any ideas?

Cheers,

Jeff

Offline eltonrauh

  • Newbie
  • *
  • Posts: 7
Re: Username Domain Drop-Down Menu.
« Reply #1 on: August 14, 2007, 08:22:01 AM »
HI :)

     This is line > // This domain will be used to form e-mail addresses of new users
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['mail_domain'] = '';  

     Specific multiple the domain also?

Offline dano

  • Full Member
  • ***
  • Posts: 124
Re: Username Domain Drop-Down Menu.
« Reply #2 on: August 14, 2007, 01:44:10 PM »
This mod was posted in the mod section quite some time ago and is used in the CPanel Password change mod as well. What they do is replace

Code: [Select]
// try to log in
if ($_action=='login' && $_task=='mail')
{
 $host = rcmail_autoselect_host();

With this

Code: [Select]
// try to log in
if(isset($_POST['_user']) && $_action == 'login' && $_task == 'mail')
 {
 if($_SERVER['SERVER_NAME'] and !preg_match('/(.*)\@(.*)/',$_POST['_user'])){
    $domain = preg_replace('/^(\w*)\./','',$_SERVER['SERVER_NAME']);
    $_POST['_user'] = $_POST['_user']."@".$domain;
 }

What that will do is allow the user to log in with just their user name and it will populate the @domain.com part with the domain name they are accessing. Rather than have my users chose from a list of domains which also shows them how many and what domains I host I prefer this method.

Offline eltonrauh

  • Newbie
  • *
  • Posts: 7
Re: Username Domain Drop-Down Menu.
« Reply #3 on: August 14, 2007, 02:17:55 PM »
Ok... but this code I insert in main.inc.php???

you have this main.inc.php?? I need equal with mine...


Thx alot..

Elton Rauh

Offline kirk

  • Newbie
  • *
  • Posts: 1
Re: Username Domain Drop-Down Menu.
« Reply #4 on: August 14, 2007, 03:29:54 PM »

  Use this function like the following:

 
Quote
// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['username_domain'] = array('mail.xx.hu' => 'xx.hu', 'mail.xy.hu' => 'xy.hu', 'mail.xv.hu' => 'xv.hu');

Offline eltonrauh

  • Newbie
  • *
  • Posts: 7
Re: Username Domain Drop-Down Menu.
« Reply #5 on: August 14, 2007, 03:42:36 PM »
   
I the same have a server with HOST and domain different… what I make?


ex: $rcmail_config['default_host'] = array('192.168.1.10' => 'ccs.org.br', '192.168.1.10' => 'altera.com');


Att..

Elton Rauh

Offline dano

  • Full Member
  • ***
  • Posts: 124
Re: Username Domain Drop-Down Menu.
« Reply #6 on: August 14, 2007, 05:21:19 PM »
Quote from: dano
This mod was posted in the mod section quite some time ago and is used in the CPanel Password change mod as well. What they do is replace

Code: [Select]
// try to log in
if ($_action=='login' && $_task=='mail')
{
 $host = rcmail_autoselect_host();

With this

Code: [Select]
// try to log in
if(isset($_POST['_user']) && $_action == 'login' && $_task == 'mail')
 {
 if($_SERVER['SERVER_NAME'] and !preg_match('/(.*)\@(.*)/',$_POST['_user'])){
    $domain = preg_replace('/^(\w*)\./','',$_SERVER['SERVER_NAME']);
    $_POST['_user'] = $_POST['_user']."@".$domain;
 }

What that will do is allow the user to log in with just their user name and it will populate the @domain.com part with the domain name they are accessing. Rather than have my users chose from a list of domains which also shows them how many and what domains I host I prefer this method.

I'm sorry, these changes should be made to the index.php in the root folder of your RoundCube install.

Offline eltonrauh

  • Newbie
  • *
  • Posts: 7
Re: Username Domain Drop-Down Menu.
« Reply #7 on: August 14, 2007, 08:24:19 PM »
ahhh... ok... I will go test.... tomorrow... now I need go sleep... :) thx man...


cya...


Elton Rauh...

Offline Jaffa

  • Newbie
  • *
  • Posts: 2
Username Domain Drop-Down Menu.
« Reply #8 on: January 01, 2009, 02:48:39 AM »
Thanks for the replies guys, I havnt been around for a while and I'll probably get flamed for binging up an old post but I wanted to show my appreciation, and also a big thanks also to dano - that seemed to do the trick quite nicely :D