Author Topic: Setting Login Username format with cPanel Webmail Password plugin  (Read 172 times)

Offline justM

  • Newbie
  • *
  • Posts: 5
Greetings guys.

I am trying to allow mail users to be able to login using the username part of the email address instead of typing the full email (basically omit the domain part of it) e.g. if a user's email address is 'myname@domain.com', to allow them to use 'myname' part only for login. If possible to have both options available.

I edited the config.inc.php file:
Code: [Select]
// Various drivers/setups use different format of the username.
// This option allows you to force specified format use. Default: '%u'.
// Supported variables:
//     %u - full username,
//     %l - the local part of the username (in case the username is an email address)
//     %d - the domain part of the username (in case the username is an email address)
// Note: This may no apply to some drivers implementing their own rules, e.g. sql.
$config['password_username_format'] = '%l';

This still doesn't allow login without the domain part (domain.com)

Is it possible with cPanel Webmail Password plugin in the first place?

I have Roundcube 1.4.4 installed (had also tried with 1.4.3) on subdomain.

Thank you!

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,438
Re: Setting Login Username format with cPanel Webmail Password plugin
« Reply #1 on: May 21, 2020, 12:39:21 PM »
That looks like the config from the password plugin that ships with Roundcube. If so then that option is only for setting how to handle the username when changing the password - so if what ever back end you have requires the username in a specific format. For logins look in your main roundcube config file. Have a look at the option `username_domain`.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline justM

  • Newbie
  • *
  • Posts: 5
Re: Setting Login Username format with cPanel Webmail Password plugin
« Reply #2 on: May 21, 2020, 01:41:08 PM »
Damn. Hadn't noticed that am on the wrong file. Though I also can't seem to locate that main file. Where should it be located?

Thanks a bunch!

Offline justM

  • Newbie
  • *
  • Posts: 5
Re: Setting Login Username format with cPanel Webmail Password plugin
« Reply #3 on: May 21, 2020, 04:49:34 PM »
So I've actually realised am on the correct file from the explanation on the attached image.


and true, the code snippet I posted earlier was about the Passwords Plugin (Since to implement the passwords plugin, I had to copy it into config.inc.php)

Now what I don't have is any code on config.inc.php that has 'username_domain'

Any help with that?

Offline justM

  • Newbie
  • *
  • Posts: 5
Re: Setting Login Username format with cPanel Webmail Password plugin
« Reply #4 on: May 21, 2020, 05:10:25 PM »
Solved it from a post I found!  8)

It's as simple as adding these lines

Code: [Select]
// 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
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
$config['username_domain'] = 'domain.com';

 to the main roundcube config file which is config.inc.php (replace domain.com with your domain)

Going to leave this here for other noobs like me. Thank you!