Remove IMAP domain from username

I have IMAP auth enabled. My users can login with "username" or with "username@domain" which creates 2 different OC accounts

There's any way to remove the domain?

Are you using an LDAP server?

You could setup an authentication via LDAP, that way you can add an email adress to the username, so you have only 1 account for 1 user.

If you use IMAP, you would have to only allow users to login via email address to avoid 2 user accounts for 1 user.

SOLVED is outdated

There's a "$domain" parameter to the imap config documented in the module (committed on Jul 30, 2015)

Add the following to your config.php:

'user_backends' => array(
        'class' => 'OC_User_IMAP',
        'arguments' => array(
            '{}', ''

This connects to the IMAP server on IP, in readonly mode. If a domain name (e.g. is specified, then this makes sure that only users from this domain will be allowed to login. After successfull login the domain part will be striped and the rest used as username in ownCloud. e.g. '' will be 'username' in ownCloud.

This will parameter will also reject logins with other domains, which is not a problem in my case.

Thank you for figuring that out, the documentation needs to be updated