RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > Third Party Contributions > Plug-Ins

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 07-26-2006, 04:13 AM
Registered User
 
Join Date: Jul 2006
Posts: 2
Downloads: 0
Uploads: 0
Default Multiple Domains Login

I just downloaded RoundCube, and I love it so far. I host over 50 domains and people hated typing in their full email addresses to login. This will only work if you have mail.domain.com, mail.domain2.com, etc. I quickly made a solution.



Before you start, make backups.

index.php

Under if ($_action=='login' && $_task=='mail'){ add :
Code:
$user = "$_POST[_user]@" . substr($_SERVER[HTTP_HOST], 5) . "";
And then change :
Code:
else if (isset($_POST['_user']) && isset($_POST['_pass']) && rcmail_login($_POST['_user'], $_POST['_pass'], $host))
to

Code:
else if (isset($user) && isset($_POST['_pass']) && rcmail_login($user, $_POST['_pass'], $host))
That takes care of the actually logging in part. Now to change the form.

program/include/main.inc

Find function rcmail_login_form($attrib)

Change

Code:
$input_user = new textfield(array('name' => '_user', 'size' => 30));
to
Code:
$input_user = new textfield(array('name' => '_user', 'size' => 15));
Change

Code:
$fields['user'] = $input_user->show($_POST['_user']);
to
Code:
 $fields['user'] = "" . $input_user->show($_POST['_user']) . " @ " . substr($_SERVER[HTTP_HOST], 5) . "";
I know I could of done it 50 different ways, but this way was easy and quick.

Good luck!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 07-26-2006, 04:47 PM
bpat1434's Avatar
Administrator
 
Join Date: Jun 2006
Location: Maryland, USA
Posts: 597
Downloads: 16
Uploads: 0
Send a message via ICQ to bpat1434 Send a message via AIM to bpat1434 Send a message via MSN to bpat1434 Send a message via Yahoo to bpat1434 Send a message via Skype™ to bpat1434
Default Re: Multiple Domains Login

Easier than properly configuring the main.inc.php file?

PHP Code:
// 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('imap.domain.net' => 'Domain'
                                        
'imap.domain2.net' => 'Domain 2'
                                    
);

// TCP port used for IMAP connections
$rcmail_config['default_port'] = 143;

// 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('imap.domain.net' => 'domain.net',
                                         
'imap.domain2.net' => 'domain2.net'
                                         
);

// 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'] = array('imap.domain.net' => 'domain.net',
                                     
'imap.domain2.net' => 'domain2.net'
                                    
); 
Hmm... me thinks not....

Heck... you can take it one step further in ease:

PHP Code:
// 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('imap.domain.net' => 'Domain'
                                        
'imap.domain2.net' => 'Domain 2'
                                    
);

// TCP port used for IMAP connections
$rcmail_config['default_port'] = 143;

// 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('imap.domain.net' => 'domain.net',
                                         
'imap.domain2.net' => 'domain2.net'
                                         
);

// 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'] = $rcmail_config['username_domain']; 
__________________

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 07-28-2006, 11:25 PM
flosoft's Avatar
Administrator
 
Join Date: Jun 2006
Location: Brussels, Belgium
Posts: 349
Downloads: 1
Uploads: 0
Send a message via ICQ to flosoft Send a message via AIM to flosoft Send a message via MSN to flosoft
Default Re: Multiple Domains Login

thx for both tutorials
__________________
New VPS for just 9,99!
Flosoft.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 08-04-2006, 10:01 AM
Super Moderator
 
Join Date: Jun 2006
Posts: 431
Downloads: 0
Uploads: 0
Send a message via ICQ to skaero Send a message via AIM to skaero Send a message via MSN to skaero Send a message via Yahoo to skaero
Default Re: Multiple Domains Login

Its good code, But I only have one domain
__________________
[size=8pt]SKaero.com <br />&nbsp; [/size]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 08-17-2006, 11:18 AM
Registered User
 
Join Date: Aug 2006
Posts: 2
Downloads: 0
Uploads: 0
Default Re: Multiple Domains Login

ok guys, the second solution sounds great but its not really useful.

all my customers also use: mail.domain1.com mail.domain2.com etc...

that means I do not want them to see a dropdown of all the domains I host (in coolants example it would be a dropdown list of 50 domains) and chose theirs from the list, instead roundcube should be able to detect the domain where the user logged in from, strip mail. from it and append it to the username, at least thats what some plugins for squirrelmail can do...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 08-17-2006, 08:21 PM
bpat1434's Avatar
Administrator
 
Join Date: Jun 2006
Location: Maryland, USA
Posts: 597
Downloads: 16
Uploads: 0
Send a message via ICQ to bpat1434 Send a message via AIM to bpat1434 Send a message via MSN to bpat1434 Send a message via Yahoo to bpat1434 Send a message via Skype™ to bpat1434
Default Re: Multiple Domains Login

Hmm..... so you'd want something like:

PHP Code:
$user $_POST['_user'].'@'.substr($_SERVER['HTTP_HOST'], 5); 
right?
__________________

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 09-28-2006, 07:51 AM
Registered User
 
Join Date: Sep 2006
Posts: 6
Downloads: 0
Uploads: 0
Default Re: Multiple Domains Login

Cool plugin but i was wondering lets say you only have one domain
and i don t want my users to have to type in their domain and or server info think you could make something for that
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 09-28-2006, 08:54 AM
Registered User
 
Join Date: Aug 2006
Posts: 15
Downloads: 0
Uploads: 0
Default Re: Multiple Domains Login

yada, you can use the same example above or if you don't mind them typing in their account name (everything before @yourserver.com) and password you can do this without a plugin by specifying a domain in the config file.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 09-29-2006, 05:28 AM
Registered User
 
Join Date: Sep 2006
Posts: 6
Downloads: 0
Uploads: 0
Default Re: Multiple Domains Login

wow cool thanx man
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10  
Old 10-11-2006, 10:52 AM
Registered User
 
Join Date: Oct 2006
Posts: 4
Downloads: 0
Uploads: 0
Default Re: Multiple Domains Login

Quote:
Originally Posted by Brett
Hmm..... so you'd want something like:

PHP Code:
$user $_POST['_user'].'@'.substr($_SERVER['HTTP_HOST'], 5); 
right?
This looks great. In which file i must wrote this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

For more information about the ads and why they're here, please see the FAQ

All times are GMT. The time now is 04:34 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright © 2006-2008 RoundCube Webmail Community