Page MenuHomePhabricator

Authentication should have a way to customize the credentials name
Open, Needs TriagePublic


Currently, when you go to your custom phabricator instance to log in (and you have set it up with LDAP login) it presents you with a login window saying LDAP. It would be great if the install could customize the name presented here since there may be more than one LDAP server at the company with their own names. We currently have this situation where users have multiple internal accounts. They often get confused when they can't log in since the log in screen asks for LDAP (which is the name of one of the LDAP accounts used for email, calendar, etc) and we actually need them to use a different log in LDAP server account named OpenDirectory (used for other internal purposes).

Event Timeline

Essentially I would like to customize the "Login or register with LDAP" here to be "Login or register with OpenDirectory"

Login.png (808×1 px, 51 KB)

Can you just override the translation? /config/edit/translation.override/

This is probably something we'll need in the very long run for T6703 (if we legitimately let you connect to two different LDAP servers, it would be silly to have two "Login with LDAP" dialogs) but, yeah, using translation.override or just editing PhabricatorLDAPAuthProvider might be the shortest path today.

There are a bunch of different strings so this probably isn't quite as simple as just having a "Provider Display Name" field:

    if ($mode == 'link') {
      $dialog->setTitle(pht('Link LDAP Account'));
      $dialog->addSubmitButton(pht('Link Accounts'));
    } else if ($mode == 'refresh') {
      $dialog->setTitle(pht('Refresh LDAP Account'));
      $dialog->addSubmitButton(pht('Refresh Account'));
    } else {
      if ($this->shouldAllowRegistration()) {
        $dialog->setTitle(pht('Login or Register with LDAP'));
        $dialog->addSubmitButton(pht('Login or Register'));
      } else {
        $dialog->setTitle(pht('Login with LDAP'));
      if ($mode == 'login') {


        id(new AphrontFormTextControl())
          ->setLabel(pht('LDAP Username'))
        id(new AphrontFormPasswordControl())
          ->setLabel(pht('LDAP Password'))

The translation.override settings seems to be the easiest path forward. I definitely don't want to be modifying the source if I can help it.

From your snippet above it seems like you could achieve something simple for now by allowing only the name to be customized and not the whole strings:

$dialog->setTitle(pht('Login or Register with ' + providerName));

(excuse my lack of php knowledge)

Strings with sentence fragments like that can be difficult to translate in the normal human language sense, see:

e.g., in Spanish that it may translate as "Iniciar sesión con la..." or "Iniciar sesión con el..." depending on the gender of the noun (I don't speak Spanish and have no idea if those particular translations are correct or not, just that the fragment may vary based on the noun gender in some languages).

Ah yes I forgot about the fun of internationalization. Btw those fragments are correct 👍🏻 (I speak Spanish).