Author Topic: Add domain name to right of username textbox  (Read 3964 times)

Offline CHFShane

  • Newbie
  • *
  • Posts: 2
Add domain name to right of username textbox
« on: August 17, 2006, 04:25:29 AM »
Okay, I have a request for a little bit of code.

First off, whenever you're viewing the login page of roundcube, you have your username/password boxes.

I would like to put my domain name off to the right of the username box. That way my users will know that they ONLY have to enter their username, and not their full email address.

So basically...they'll have the username text box where they enter their username. Right to the right of the text box, I either want just plain text that says "@mydomain.com", or...I want it to be in one of those greyed out text boxes that says "@mydomain.com".

What code would I use to make either of these, and where would I put it?

Thanks for your help. So far, I love this software. :)

Offline ric

  • Newbie
  • *
  • Posts: 6
Re: Add domain name to right of username textbox
« Reply #1 on: August 17, 2006, 09:31:30 PM »
Edit the following in program/include/main.inc

Line 1606 reads
 $input_user = new textfield(array('name' => '_user', 'id' => 'rcmloginuser', 'size' => 30));

Change to
 $input_user = new textfield(array('name' => '_user', 'id' => 'rcmloginuser', 'size' => 15));

Line 1701 reads

 $fields['user'] = $input_user->show(get_input_value('_user', RCUBE_INPUT_POST));

Change to
 $fields['user'] = $input_user->show(get_input_value('_user', RCUBE_INPUT_POST)). " @DOMAIN.COM";

Credit to coolant for the code, taken from his 'Muliply Domains Login'

Offline boblehue

  • Newbie
  • *
  • Posts: 1
Re: Add domain name to right of username textbox
« Reply #2 on: August 25, 2006, 06:26:25 AM »

If you have more then one domain login and want your drop down box on the right of username, just change this in main.inc :






$fields[host]


EOF;

 $OUTPUT->add_script("$JS_OBJECT_NAME.gui_object('loginform', '$form_name');");
 
 $out = <<$form_start
$SESS_HIDDEN_FIELD
$fields[action]









$form_host
$fields[user]
$fields[pass]

$form_end


To look like this :





EOF;

 $OUTPUT->add_script("$JS_OBJECT_NAME.gui_object('loginform', '$form_name');");
··
 $out = <<$form_start
$SESS_HIDDEN_FIELD
$fields[action]












$form_host
$fields[user]$fields[host]
$fields[pass]

$form_end


If your mail servers is mail.domain.com and mail.domain1.com and you would like the drop down box
to just show your domains, just set your /config/main.inc.php to look like this!


Code: [Select]
// the mail host chosen to perform the log-in
// leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL connection, enter ssl://hostname:993
$rcmail_config['default_host'] = array('mail.domain.com'=>'domain.com',
                      'mail.domain1.com'=>'domain1.com');




Offline FatJonny

  • Jr. Member
  • **
  • Posts: 48
Re: Add domain name to right of username textbox
« Reply #3 on: November 16, 2006, 06:59:58 PM »
Quote from: ric
Edit the following in program/include/main.inc

Line 1606 reads
 $input_user = new textfield(array('name' => '_user', 'id' => 'rcmloginuser', 'size' => 30));

Change to
 $input_user = new textfield(array('name' => '_user', 'id' => 'rcmloginuser', 'size' => 15));

Line 1701 reads

 $fields['user'] = $input_user->show(get_input_value('_user', RCUBE_INPUT_POST));

Change to
 $fields['user'] = $input_user->show(get_input_value('_user', RCUBE_INPUT_POST)). " @DOMAIN.COM";

Credit to coolant for the code, taken from his 'Muliply Domains Login'

I followed this bit of code, but my login page will not accept the username without the @domain.com, I'm just getting "login failed". What else do I need to change to correct this?

Offline FatJonny

  • Jr. Member
  • **
  • Posts: 48
Re: Add domain name to right of username textbox
« Reply #4 on: November 16, 2006, 10:46:24 PM »
Never mind, I got it! It's in main.inc.php. Change yourdomain.co, to your domain.

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'] = 'yourdomain.com';