* (bug 2609) Fix text justification preferenced with MonoBook skin.
* (bug 2594) Display article tab as red for non-existent articles.
* (bug 2656) Fix regression: prevent blocked users from reverting images
+* (bug 2629) Automatically capitalize usernames again instead of
+ rejecting lowercase with a useless error message
+
=== Caveats ===
$name = trim( $this->mName );
$u = User::newFromName( $name );
- if ( is_null( $u ) || !$wgUser->isValidUserName( $name ) ) {
+ if ( is_null( $u ) ) {
$this->mainLoginForm( wfMsg( 'noname' ) );
return false;
}
function newFromName( $name ) {
$u = new User();
+ # Force usernames to capital
+ global $wgContLang;
+ $name = $wgContLang->ucfirst( $name );
+
# Clean up name according to title rules
-
$t = Title::newFromText( $name );
if( is_null( $t ) ) {
- return NULL;
- } else {
- $u->setName( $t->getText() );
- $u->setId( $u->idFromName( $t->getText() ) );
- return $u;
+ return null;
}
+
+ # Reject various classes of invalid names
+ $canonicalName = $t->getText();
+ if( !User::isValidUserName( $canonicalName ) ) {
+ return null;
+ }
+
+ $u->setName( $canonicalName );
+ $u->setId( $u->idFromName( $t->getText() ) );
+ return $u;
}
/**
*
* @param string $name
* @return bool
+ * @static
*/
function isValidUserName( $name ) {
global $wgContLang, $wgMaxNameChars;
if ( $name == ''
- || $this->isIP( $name )
+ || User::isIP( $name )
|| strpos( $name, '/' ) !== false
|| strlen( $name ) > $wgMaxNameChars
|| $name != $wgContLang->ucfirst( $name ) )
*
* @param string $password
* @return bool
+ * @static
*/
function isValidPassword( $password ) {
global $wgMinimalPasswordLength;