Author Topic: removing @domain.com from login  (Read 12573 times)

Offline tal

  • Newbie
  • *
  • Posts: 1
removing @domain.com from login
« on: August 07, 2006, 10:53:28 AM »
Hey,

just to be a pain, how do i make it so i dont have to add @domain.com when i log on???
like what scripts do i have to edit, and what need to be changed... and with what :P

sorry for being an annoyance,
Tal

Offline schroder

  • Newbie
  • *
  • Posts: 2
Re: removing @domain.com from login
« Reply #1 on: August 07, 2006, 10:56:37 AM »
in main.inc.php
... add your domain name to $rcmail_config['default_host'] = ''; on line 38

(I had just the same issue)

Offline yfastud

  • Newbie
  • *
  • Posts: 9
Re: removing @domain.com from login
« Reply #2 on: August 07, 2006, 11:20:13 AM »
Already did it, and it did hide domain at login screen, but wonder how to configure so only input username instead the full email address. Any idea?
Thanks a million

Offline Scubes13

  • Jr. Member
  • **
  • Posts: 48
Re: removing @domain.com from login
« Reply #3 on: August 07, 2006, 11:25:44 AM »
First of all, the quickest way (if you use a single domain) might be to follow the instructions from Brett about listing the domains in a drop down or adding a single domain to the config file. His instructions can be found here: http://roundcubeforum.net/forum/index.php?topic=212.msg1078#msg1078


However, our company hosts several domains on one server. When implementing a software such as roundcube, we like to have one central install that eases the pains of configuring and maintaining. Each domain hosted simply references the central install via sym-links.

Anyways, whether that makes sense or not, I wanted to setup a way that the login screen would figure out the mail server domain name without me having to manually set it in a config file or the user inputting it at each login. So, I basically switched out line 33 of main.inc.php with this line:

Code: [Select]
$rcmail_config['default_host'] = 'mail.' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

Basically, it takes the address in the address bar, removes the "http://www." and adds "mail." to the beginning of the domain name.

Ex) http://www.yourname.com to yourname.com to mail.yourname.com

I am sure this all seems very basic and straight forward to the more seasoned programmer, but I was excited about getting it to work.

We also then use the same principal to generate the SMTP server address and the username. It looks as follows:
Code: [Select]
// use this host for sending mails.
// to use SSL connection, set ssl://smtp.host.com
// if left blank, the PHP mail() function is used
$rcmail_config['smtp_server'] = 'mail.' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login
$rcmail_config['smtp_user'] = '%u' . '@' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

// SMTP password (if required) if you use %p as the password RoundCube
// will use the current user's password for login
$rcmail_config['smtp_pass'] = '%p';

Hope it helps in some way.

Kevin L.



Offline schroder

  • Newbie
  • *
  • Posts: 2
Re: removing @domain.com from login
« Reply #4 on: August 07, 2006, 11:27:16 AM »
Quote from: yfastud
how to configure so only input username instead the full email address

Surely that's a server issue and the 'long user names' option seems to have been selected. Hope you have a a control panel to adjust that because I haven't a clue how to recommend raw code.

Offline jbouklas

  • Newbie
  • *
  • Posts: 7
Re: removing @domain.com from login
« Reply #5 on: August 07, 2006, 05:01:36 PM »
Quote from: Scubes13
First of all, the quickest way (if you use a single domain) might be to follow the instructions from Brett about listing the domains in a drop down or adding a single domain to the config file. His instructions can be found here: http://roundcubeforum.net/forum/index.php?topic=212.msg1078#msg1078


However, our company hosts several domains on one server. When implementing a software such as roundcube, we like to have one central install that eases the pains of configuring and maintaining. Each domain hosted simply references the central install via sym-links.

Anyways, whether that makes sense or not, I wanted to setup a way that the login screen would figure out the mail server domain name without me having to manually set it in a config file or the user inputting it at each login. So, I basically switched out line 33 of main.inc.php with this line:

Code: [Select]
$rcmail_config['default_host'] = 'mail.' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

Basically, it takes the address in the address bar, removes the "http://www." and adds "mail." to the beginning of the domain name.

Ex) http://www.yourname.com to yourname.com to mail.yourname.com

I am sure this all seems very basic and straight forward to the more seasoned programmer, but I was excited about getting it to work.

We also then use the same principal to generate the SMTP server address and the username. It looks as follows:
Code: [Select]
// use this host for sending mails.
// to use SSL connection, set ssl://smtp.host.com
// if left blank, the PHP mail() function is used
$rcmail_config['smtp_server'] = 'mail.' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login
$rcmail_config['smtp_user'] = '%u' . '@' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

// SMTP password (if required) if you use %p as the password RoundCube
// will use the current user's password for login
$rcmail_config['smtp_pass'] = '%p';

Hope it helps in some way.

Kevin L.




I tried that method, to no avail. When I log in, I have to type username@mydomain.com. Shouldn't this allow you to just type in username, and it automatically sends @mydomain.com?

-Jim

Offline Scubes13

  • Jr. Member
  • **
  • Posts: 48
Re: removing @domain.com from login
« Reply #6 on: August 07, 2006, 05:17:34 PM »
That is what it should do.


Because the line:

Code: [Select]
$rcmail_config['smtp_user'] = '%u' . '@' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);
...should generate 'username' + '@' + 'domain.ext' as a string. Again, check your SMTP-Auth logs and let us know what you see.

You may want to check your logs to see what it is actually outputting as the username when it tries to login. (IE - see if something else is being appended to the username that is dorking it.)

I have been running the above posted code for quite a while, across many versions of RC, including the current Beta 2.

Kevin L.

Offline sleezstak

  • Newbie
  • *
  • Posts: 9
Re: removing @domain.com from login
« Reply #7 on: August 07, 2006, 07:59:56 PM »
will it work if my rc is not within the root http://www.mydomain/webmail

Offline Scubes13

  • Jr. Member
  • **
  • Posts: 48
Re: removing @domain.com from login
« Reply #8 on: August 07, 2006, 08:06:43 PM »
It should. It is only acquiring the HTTP_HOST which would be the domain name. (IE - http://www.domain.ext)

Kevin L.

Offline SViRU

  • Jr. Member
  • **
  • Posts: 20
Re: removing @domain.com from login
« Reply #9 on: August 08, 2006, 07:20:07 AM »
When you have one domain, ( multiple domain not tested )

Just only need to edit main.inc.php in line 46

// 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'] = 'your.domain.com';

then you can login only with username

if you have aliases for account, example n.surname:username

you need to create file virtuser and put them:
## virtuser ##
n.surname@your.domain.com  username
## eof ##

next you must edit line 53 in file main.inc.php

// Path to a virtuser table file to resolve user names and e-mail addresses
$rcmail_config['virtuser_file'] = 'config/virtuser'; ( your patch, i create file in config dir )

and you can login to webmail as username or n.surname without @your.domain.com





Offline jbouklas

  • Newbie
  • *
  • Posts: 7
Re: removing @domain.com from login
« Reply #10 on: August 08, 2006, 10:25:35 AM »
VIRUS, thanks! That adding the "mail_domain" part did the trick. Now I'm going to start playing with virtusers.

-Jim

Offline finch13

  • Newbie
  • *
  • Posts: 6
Re: removing @domain.com from login
« Reply #11 on: August 10, 2006, 12:49:53 PM »
I've got a similar question,

When I login I need to use this format: user+domain.com

for some reason my login is + instead of @.

I'm a single domain user, so I don't need fancy pull downs, but how can I make it so I just need to type in "user"?

I tried modifying main.inc.php $rcmail_config['username_domain'] = $rcmail_config['username_domain'] = 'domain.com'; with no success.

Any ideas?

Offline andresme

  • Jr. Member
  • **
  • Posts: 16
Re: removing @domain.com from login
« Reply #12 on: August 10, 2006, 04:28:24 PM »
So do you have to add this string into the table? I don't seem to have this in my main.inc.php file

// 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'] = 'your.domain.com';

If so, what is the "your" part or yourdomain.com the same?

I tried inserting / pasting that into my file where line 46 would be and using domain.com but it didn't work either.

I also tried putting my domain in line 38... but it doesn't like that either.

From what I understand... my line 38 has to say 'localhost'.

Any ideas?

Offline schrab

  • Newbie
  • *
  • Posts: 1
Re: removing @domain.com from login
« Reply #13 on: January 24, 2007, 03:29:12 AM »
Quote from: finch13
I've got a similar question,

When I login I need to use this format: user+domain.com

for some reason my login is + instead of @.

I'm a single domain user, so I don't need fancy pull downs, but how can I make it so I just need to type in "user"?

I tried modifying main.inc.php $rcmail_config['username_domain'] = $rcmail_config['username_domain'] = 'domain.com'; with no success.

Any ideas?

I have got a similar problem: my imap mailserver login string format is "domain.com+user" and RC returns error:

Quote
IMAP Error: Authentication for domain.com+user failed (LOGIN): "a001 NO LOGIN failed: Login failed. Either your user name or your password was wrong. Please try again, and if the problem persists, please contact your system administrator."