Bo Wang
Bo Wang

Reputation: 509

Use email as username in Mediawiki

I encounter some issues while I want to integrate my mediawiki to my enterprise LDAP server with LDAPExtension. Our LDAP server uses email as uid, so I have to use email as the input username in mediawiki. But while I login with email, after LDAP authentication pass, mediawiki always prompt: "Auto-creation of a local account failed: You have not specified a valid username." , it means the username is invalid. I also tried to create a mediawiki user with email as username, it has same error.

So is it possible to let mediawiki ignore username validation to let email can be a username?

Upvotes: 0

Views: 1224

Answers (2)

Tgr
Tgr

Reputation: 28160

Change $wgInvalidUsernameCharacters.


Note that logging in with the email address might become possible at some point.

Upvotes: 1

wakalaka
wakalaka

Reputation: 533

Add these lines to the bottom of your LocalSettings.php:

$wgUserrightsInterwikiDelimiter = "%";
$wgInvalidUsernameCharacters = "%:";
  • $wgUserrightsInterwikiDelimiter specifies what character to use in database for interwiki delimiters, by default it has value @ and leads to error if you will try to create account with @ in username
  • $wgInvalidUsernameCharacters - list of characters restricted to be used in usernames, original value is @:

Upvotes: 3

Related Questions