[RCU] auto domain login

p8x l at p8x.net
Wed Dec 30 09:58:55 CET 2009


Hi Jim,

I made a few modifications to the roundcube that I use at work to do
exactly this, plus a quick check to see if the mail server they are
connecting to is in our IP space as well. The idea behind the IP
checking is that we are a web hosting company that also sells a couple
of other products (VPS's etc.) and we want to allow anyone that has any
hosting with us to be able to use the webmail facility when we don't
specifically know which domains they will be using with it.

I have not bothered to make this as a plugin or anything as its
specifically modified for this cluster.

In /index.php:

Find this (line 80 for latest stable):
// try to log in
if ($RCMAIL->action=='login' && $RCMAIL->task=='mail') {

Add this after:
  // Split the email address up into user and domain.
  list($user, $domain) = split('@', trim(get_input_value('_user',
RCUBE_INPUT_POST), ' '));

This will give you the username ($username) and the domain ($domain) so
it just splits it in the '@'. This example modification will connect to
$domain.

You then need to change one more thing to make it actually log into the
server that we got above. Look for this:
  $auth = $RCMAIL->plugins->exec_hook('authenticate', array(

Directly below will be a host variable, remove that line and change it
to (as far as input validation is concerned, please do it, I do it in my
script as part of IP checking. I assume that RoundCube does aswell but
it is better to be safe than sorry!):

    'host' => $domain,

If you needed to, you could change it to "mail.$domain" or what ever you
need to connect to (previously we had it doing a mySQL lookup then
connecting to a preferred server.

I also made a modification to it so that roundcube sent out the specific
SMTP server was using, if your interested I can provide some details for
that too.

p8x

On 30/12/2009 9:26 AM, Jim Pazarena wrote:
> I am wondering if anyone has created a method to specify a domain name
> on the address bar to eliminate the user from having to enter it. I
> know that a 'default' can be set up, but this is not what I am intending.
> I host webmail for dozens of domains. It would be very convenient if the
> main index page (index.php) could have the domain attached; such as:
> http://www.maindomain.net/roundcube/index.php/?_domain=custdomain.com
> would/could create a login page which does NOT require a complete email
> address, but attaches the "custdomain.com" to the userID which the
> customer
> has entered. If they bookmarked the link to: /?_domain=custdomain.com
> they would never have to enter their domain name.
> 
> If this has been accomplished I would appreciate learning about it, else
> I will delve into the code required to accomplish it. ... OR if someone
> advises that existing architecture would make it very difficult I would
> appreciate learning this as well.
> 
> Thanks!
> 
> Jim
> _______________________________________________
> List info: http://lists.roundcube.net/users/


_______________________________________________
List info: http://lists.roundcube.net/users/



More information about the users mailing list