Hi
There was a question on that list a while ago, about how to login without all this @domain.foo stuff. I'm puting this patch once again, becouse of some problems with implementation by some of you. I don't say that it's the most secure version of resolving this little inconvenience, but you can try it and judge yourself.
How it works?
Just apply patches, and make one change to main.inc.php file:
webmails prefix ended with .
Wojtek
--- index.php Fri Nov 25 17:48:10 2005 +++ index.php Fri Nov 25 17:48:18 2005 @@ -116,13 +116,18 @@ if ($_action=='login' && $_task=='mail') { $host = $_POST['_host'] ? $_POST['_host'] : $CONFIG['default_host'];
if (eregi("@", $_POST['_user']))
$userdn = $_POST['_user'];
else
$userdn = $_POST['_user'] . '@' . '' . str_replace($CONFIG['bypass_domain_name'], "", $_SERVER['HTTP_HOST']);
// check if client supports cookies if (empty($_COOKIE)) { show_message("cookiesdisabled", 'warning'); }
--- config/main.inc.php Fri Nov 25 17:47:54 2005 +++ config/main.inc.php Fri Nov 25 17:56:34 2005 @@ -27,6 +27,11 @@ // set to false if only registered users can use this service $rcmail_config['auto_create_user'] = TRUE;
+// removes prefix of domain name that is used before webmail server +// for example, for http://mail.domain.foo/ type 'mail.' +// this allows you as an option to log without typing @domain.foo +$rcmail_config['bypass_domain_name'] = '';
// 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.
Hello,
I wrote a similar patch a few weeks ago (see attached file). The main benefit with my implementation is if you're servicing multiple domains, it will generate a pull down box for you with the domains for the user to choose.
Regards, Stephen
On 11/25/05, Wojtek subs@donkoyote.net wrote:
Hi
There was a question on that list a while ago, about how to login without all this @domain.foo stuff. I'm puting this patch once again, becouse of some problems with implementation by some of you. I don't say that it's the most secure version of resolving this little inconvenience, but you can try it and judge yourself.
How it works?
Just apply patches, and make one change to main.inc.php file:
- variable $rcmail_config['pass_domain_name'] should be set with your
webmails prefix ended with .
regards
Wojtek
--- index.php Fri Nov 25 17:48:10 2005 +++ index.php Fri Nov 25 17:48:18 2005 @@ -116,13 +116,18 @@ if ($_action=='login' && $_task=='mail') { $host = $_POST['_host'] ? $_POST['_host'] : $CONFIG['default_host'];
- if (eregi("@", $_POST['_user']))
- $userdn = $_POST['_user'];
- else
- $userdn = $_POST['_user'] . '@' . '' .
str_replace($CONFIG['bypass_domain_name'], "", $_SERVER['HTTP_HOST']);
// check if client supports cookies if (empty($_COOKIE)) { show_message("cookiesdisabled", 'warning'); }
- else if (isset($_POST['_user']) && isset($_POST['_pass']) &&
rcmail_login($_POST['_user'], $_POST['_pass'], $host))
- else if (isset($_POST['_user']) && isset($_POST['_pass']) &&
rcmail_login($userdn, $_POST['_pass'], $host)) { // send redirect header("Location: $COMM_PATH");
--- config/main.inc.php Fri Nov 25 17:47:54 2005 +++ config/main.inc.php Fri Nov 25 17:56:34 2005 @@ -27,6 +27,11 @@ // set to false if only registered users can use this service $rcmail_config['auto_create_user'] = TRUE;
+// removes prefix of domain name that is used before webmail server +// for example, for http://mail.domain.foo/ type 'mail.' +// this allows you as an option to log without typing @domain.foo +$rcmail_config['bypass_domain_name'] = '';
// 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.
Hi
It depends on what you need, I think that both patches are ok, in my intention was to discover vhosts, because I serve webmail configured on domains not on one permanent url. So feel free to choose between them, maybe in official release there will be something like merged functionality of those two ;)
Wojtek
Stephen wrote:
Hello,
I wrote a similar patch a few weeks ago (see attached file). The main benefit with my implementation is if you're servicing multiple domains, it will generate a pull down box for you with the domains for the user to choose.
Regards, Stephen
On 11/25/05, *Wojtek* <subs@donkoyote.net mailto:subs@donkoyote.net> wrote:
Hi There was a question on that list a while ago, about how to login without all this @domain.foo stuff. I'm puting this patch once again, becouse of some problems with implementation by some of you. I don't say that it's the most secure version of resolving this little inconvenience, but you can try it and judge yourself. How it works? Just apply patches, and make one change to main.inc.php file: - variable $rcmail_config['pass_domain_name'] should be set with your webmails prefix ended with . regards -- Wojtek --- index.php Fri Nov 25 17:48:10 2005 +++ index.php Fri Nov 25 17:48:18 2005 @@ -116,13 +116,18 @@ if ($_action=='login' && $_task=='mail') { $host = $_POST['_host'] ? $_POST['_host'] : $CONFIG['default_host']; + + if (eregi("@", $_POST['_user'])) + $userdn = $_POST['_user']; + else + $userdn = $_POST['_user'] . '@' . '' . str_replace($CONFIG['bypass_domain_name'], "", $_SERVER['HTTP_HOST']); // check if client supports cookies if (empty($_COOKIE)) { show_message("cookiesdisabled", 'warning'); } - else if (isset($_POST['_user']) && isset($_POST['_pass']) && rcmail_login($_POST['_user'], $_POST['_pass'], $host)) + else if (isset($_POST['_user']) && isset($_POST['_pass']) && rcmail_login($userdn, $_POST['_pass'], $host)) { // send redirect header("Location: $COMM_PATH"); --- config/main.inc.php Fri Nov 25 17:47:54 2005 +++ config/main.inc.php Fri Nov 25 17:56:34 2005 @@ -27,6 +27,11 @@ // set to false if only registered users can use this service $rcmail_config['auto_create_user'] = TRUE; +// removes prefix of domain name that is used before webmail server +// for example, for http://mail.domain.foo/ type 'mail.' +// this allows you as an option to log without typing @domain.foo +$rcmail_config['bypass_domain_name'] = ''; + // 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.
diff -Naur roundcubemail.orig/config/main.inc.php.dist roundcubemail.new/config/main.inc.php.dist --- roundcubemail.orig/config/main.inc.php.dist Sun Nov 13 10:27:17 2005 +++ roundcubemail.new/config/main.inc.php.dist Sun Nov 13 14:31:57 2005 @@ -33,6 +33,14 @@ // To use SSL connection, enter ssl://hostname:993 $rcmail_config['default_host'] = '';
+// When administering webmail for more than 1 domain's email on the same IMAP server +// and users need to login with their full email address, provide a select box +// with all of the domains being serviced. @domain.com is then appended +// to the username before being sent to the IMAP server. +// e.g. $rcmail_config['login_domains'] = array('foo.com','bar.org'); +$rcmail_config['login_domains'] = array();
// TCP port used for IMAP connections $rcmail_config['default_port'] = 143;
diff -Naur roundcubemail.orig/index.php roundcubemail.new/index.php --- roundcubemail.orig/index.php Sun Nov 13 10:27:17 2005 +++ roundcubemail.new/index.php Sun Nov 13 14:52:58 2005 @@ -114,13 +114,14 @@ if ($_action=='login' && $_task=='mail') { $host = $_POST['_host'] ? $_POST['_host'] : $CONFIG['default_host'];
- $domain = $_POST['_domain'] ? $_POST['_domain'] : null;
- // check if client supports cookies if (empty($_COOKIE)) { show_message("cookiesdisabled", 'warning'); }
- else if (isset($_POST['_user']) && isset($_POST['_pass']) && rcmail_login($_POST['_user'], $_POST['_pass'], $host))
- else if (isset($_POST['_user']) && isset($_POST['_pass']) && rcmail_login($_POST['_user'], $_POST['_pass'], $host,$domain)) { // send redirect header("Location: $COMM_PATH");
@@ -302,4 +303,4 @@ 'file' => __FILE__, 'message' => "Invalid request"), TRUE, TRUE);
-?> \ No newline at end of file +?> diff -Naur roundcubemail.orig/program/include/main.inc roundcubemail.new/program/include/main.inc --- roundcubemail.orig/program/include/main.inc Sun Nov 13 10:27:17 2005 +++ roundcubemail.new/program/include/main.inc Sun Nov 13 15:02:51 2005 @@ -30,7 +30,7 @@
// check client $BROWSER = rcube_browser();
- // load config file include_once('config/main.inc.php'); $CONFIG = is_array($rcmail_config) ? $rcmail_config : array();
@@ -245,11 +245,15 @@
// perfom login to the IMAP server and to the webmail service -function rcmail_login($user, $pass, $host=NULL) +function rcmail_login($user, $pass, $host=NULL, $domain=null) { global $CONFIG, $IMAP, $DB, $sess_user_lang; $user_id = NULL;
- // add @domain if $domain is set.
- //
- $user = $domain ? "$user@$domain" : $user;
- if (!$host) $host = $CONFIG['default_host'];
@@ -1034,16 +1038,27 @@ $labels['user'] = rcube_label('username'); $labels['pass'] = rcube_label('password'); $labels['host'] = rcube_label('server');
$labels['dom'] = rcube_label('domain');
$input_user = new textfield(array('name' => '_user', 'size' => 30)); $input_pass = new passwordfield(array('name' => '_pass', 'size' => 30)); $input_action = new hiddenfield(array('name' => '_action', 'value' => 'login'));
- $fields = array(); $fields['user'] = $input_user->show($_POST['_user']); $fields['pass'] = $input_pass->show(); $fields['action'] = $input_action->show();
- if (is_array($CONFIG['login_domains']) && count($CONFIG['login_domains']) > 0)
- {
- $select_domain = new select(array('name' => '_domain'));
- foreach ($CONFIG['login_domains'] as $key => $value)
$select_domain->add($value, (is_numeric($key) ? $value : $key));
- $fields['domain'] = $select_domain->show($_POST['_domain']);
- }
- if (is_array($CONFIG['default_host'])) { $select_host = new select(array('name' => '_host'));
@@ -1062,6 +1077,17 @@ $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form'; $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; $form_end = !strlen($attrib['form']) ? '</form>' : '';
- if ($fields['domain'])
- $form_domain = <<<EOF
+</tr><tr>
+<td class="title">$labels[dom]</td> +<td>$fields[domain]</td>
+EOF;
if ($fields['host']) $form_host = <<<EOF @@ -1086,8 +1112,10 @@
</tr><tr>
<td class="title">$labels[pass]</td> <td>$fields[pass]</td> +$form_domain $form_host </tr></table> $form_end @@ -1097,4 +1125,4 @@ }
-?> \ No newline at end of file +?> diff -Naur roundcubemail.orig/program/localization/en/labels.inc roundcubemail.new/program/localization/en/labels.inc --- roundcubemail.orig/program/localization/en/labels.inc Sun Nov 13 10:27:17 2005 +++ roundcubemail.new/program/localization/en/labels.inc Sun Nov 13 10:48:23 2005 @@ -23,6 +23,7 @@ $labels['password'] = 'Password'; $labels['server'] = 'Server'; $labels['login'] = 'Login'; +$labels['domain'] = 'Domain';
// taskbar $labels['logout'] = 'Logout'; @@ -176,4 +177,4 @@ $labels['sortasc'] = 'Sort ascending'; $labels['sortdesc'] = 'Sort descending';
-?> \ No newline at end of file +?>