Changing username schema

Hi there! I know this is a rather unusual support request, but all I need is a code hint. Here is the problem: right now, I have the username schema set to domain_user. However, due to a merger and to streamline documentation and support, I want to change it to user@domain. I know this has implications with Postfix, which is why Virtualmin duplicates users, one with user-domain and the other with user@domain. So I thought I make use of that for a transitional period, and basically added duplicate users in user@domain format for all my domain_user users. So this works fine as far as logins go, however in the Virtualmin users list the users show up twice, because the duplicate user is in domain_user format and not user-domain. So I digged around in the code and came along this one in virtual-server-lib-funcs.pl, where I replaced

sub replace_atsign
{
local $rv = $_[0];
$rv =~ s/\@/-/g;
return $rv;
}

with

sub replace_atsign
{
local $rv = $_[0];
my @altusr = split /@/, $rv;
return join "_", $altusr[1], $altusr[0];
}

So this has the desired effect in that the users are no longer showing up twice in the user lists, and also creating new users works fine in that two users with user@domain and domain_user are created and the virtual address is properly setup in postfix also. There is one remaining problem however: for some reason, the users show up as if not having email enabled, even though it is. The behavior is correct though if I revert the patch and create a new user, that user shows up fine. So I guess there is some other code I need to touch, but was not able to find which one. Are you able to give me a hint here? Not asking for any code change, I am perfectly happy with running a patched Virtualmin for 1-2 months until all users have switched their clients to use the new username format.

Status: 
Closed (duplicate)

Comments

Status: Active ยป Closed (duplicate)