Author Topic: frustration on usernames  (Read 4772 times)

Offline hepkat63

  • Newbie
  • *
  • Posts: 4
frustration on usernames
« on: November 05, 2007, 04:45:10 PM »
Hi,
I am sure someone has a fix for this, but can't find it on the forum. I have lots of domains and have just setup roundcubemail. All is working fine.. but my users have to logon with name.domain  and their password. (i have set 'localhost' as the default). This works fine.
But, of course when they try to send mail from roundcube mail - their 'username ' is name.domain and if anyone tries to reply - they have a dodgy address.  So.. the user has to go to their preferences and change name.domain to name@domain.com , save and all is well.
My problem is I have thousands of users and don't want each and everyone to do this - how can i automatically have their email address in their profile when they log on? anyone have an easy fix for this?
regards
steve

Offline dano

  • Full Member
  • ***
  • Posts: 124
Re: frustration on usernames
« Reply #1 on: November 07, 2007, 01:54:17 PM »
Hello Steve,

It sounds like you're using virtualhosts and have a global install of Roundcube set up at least similar to mine. Take a loot at this link and see if that works for you. When the user then goes to http://www.domain.com/roundcube they put just their user name (no @domain.com) into the log in box and the code automatically grabs the @domain.com from the address bar and puts it in. It also puts it into any other places it's needed such as their identity.

Since you have been running already and those fields are already populated with data you may need to clear them out, I'm unsure.

Hope that helps!

Dan

Offline hepkat63

  • Newbie
  • *
  • Posts: 4
Re: frustration on usernames
« Reply #2 on: November 08, 2007, 12:12:50 AM »
thanks Dan, will give it a go.. what .php file needs to be modified please? the link does not say. Also, yes - you are correct, using virtualmin with global install. The usernames are all name.domain

regards
steve

Offline dano

  • Full Member
  • ***
  • Posts: 124
Re: frustration on usernames
« Reply #3 on: November 08, 2007, 01:34:45 PM »
Hello Steve,

At the bottom of the post it says that the mod is to the index.php in the root folder of the install.

Good luck!

Dan

Offline ctraue

  • Newbie
  • *
  • Posts: 1
RC 0.2: Virtualmin, global webmail, full names from /etc/passwd
« Reply #4 on: January 25, 2009, 09:10:44 PM »
Hi,

I have written the following patch which will read the full name from /etc/passwd for the login name used to login to roundcube --- if that search doesn't return anything, the original line of code is used instead.
This code works for me on Ubuntu 8.04 LTS, with Virtualmin GPL.
Please note that I also had to set 'virtuser_file' in RC main.inc.php to /etc/postfix/virtual so that logged in users have the correct email address associated with them.

Here's the code that replaces one line in
/program/include/rcube_user.php

Code: [Select]

// replaced this original code
//      $user_name = $user != $user_email ? $user : '';
//
// with call to awk (linux utility for text/pattern manipulation)
// that compares the #1 column of /etc/passwd with $user and returns value of #5 column (full name)
// if no usable return value, the original code is used
// it seems exec() returns 0 even if the search string was not found, so $awk_return_value is not used
// NEW FROM HERE
exec("awk -F: '($1==U){print $5}' U=$user /etc/passwd", $awk_output, $awk_return_value);

if($awk_output[0] <> ''){
$user_name = $awk_output[0];
} else {
$user_name = $user != $user_email ? $user : '';
}
// TO HERE


Hope this works for others, too,

Christian