RoundCube Webmail login case sensitive

I got an issue reported to me that a user of a RoundCube Webmail setup we have had lost all his contacts. I logged in to his account and all the contacts where gone. Checked the database and found that all the contacts where still in the database. After some digging i found that there where 2 accounts in the RoundCube database. One sad the other sad When I logged on to the User account all the contacts where there! So i realized that RoundCube logon are case sensitive. He will still see his e-mail because the RoundCube doesn’t keep track of his password, it only tries to logon to the IMAP server and if logon is successful it creates it own DB-entries to keep track of contacts and other information. The IMAP server however isn’t case sensitive and User or user is the same thing for it. But there is an easy way to fix it!

RoundCube Settings

I’m running RoundCube on a IIS server so I go in to the wwwroot and on to the config folder. In the file I look for the line $rcmail_config[‘login_lc’] = false; and change it like below:
// If users authentication is not case sensitive this must be enabled.
// You can also use it to force conversion of logins to lower case.
// After enabling it all user records need to be updated, e.g. with query:
// UPDATE users SET username = LOWER(username);
$rcmail_config[‘login_lc’] = true;
Then I do a IIS reset.

Database changes

If the user have all the contacts on the lowercase account your all good. Just delete the User account and it will all be good. But if the contacts where created on the User account like in my case you have to do like this. Delete the lowercase account and then run:
[sql]UPDATE users SET username = LOWER(username) WHERE user_id = {id of uppercase account};[/sql]
If you don’t delete the lowercase account first you will get an error like this:
[plain]Error Code: 1062. Duplicate entry ‘{username}’ for key ‘username'[/plain]
If the user have spread his contacts over both accounts just change the contact table like this:
[sql]UPDATE contacts SET user_id = {id of lowercase account} WHERE user_id = {id of uppercase account};[/sql]
Then delete the uppercase account and your all good!

2 Comments on “RoundCube Webmail login case sensitive”

  1. Why where user and User so sad? Did they get some bad news or did someone hurt them? Anyway, I hope they feel more happy now.

    PS: thanks for the solution.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: