X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUserlogin.php;h=64a6f7244ec87557d275e4ffdb4bc66c64552774;hb=fd62703d505e3e233fb7842d7349a4e9302bb5f4;hp=44240d8dddf664431b7a361d7f69d87f80d1db18;hpb=f2d7596aa65973cec93abac749f311d762179b5f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 44240d8ddd..64a6f7244e 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -194,13 +194,13 @@ class LoginForm extends SpecialPage { && in_array( $entryError->getKey(), self::getValidErrorMessages() ) ) { $this->mEntryErrorType = 'error'; - $this->mEntryError = $entryError->rawParams( $loginreqlink )->escaped(); + $this->mEntryError = $entryError->rawParams( $loginreqlink )->parse(); } elseif ( $entryWarning->exists() && in_array( $entryWarning->getKey(), self::getValidErrorMessages() ) ) { $this->mEntryErrorType = 'warning'; - $this->mEntryError = $entryWarning->rawParams( $loginreqlink )->escaped(); + $this->mEntryError = $entryWarning->rawParams( $loginreqlink )->parse(); } if ( $wgEnableEmail ) { @@ -545,14 +545,11 @@ class LoginForm extends SpecialPage { return Status::newFatal( 'badretype' ); } - # check for minimal password length - $valid = $u->getPasswordValidity( $this->mPassword ); - if ( $valid !== true ) { - if ( !is_array( $valid ) ) { - $valid = array( $valid, $wgMinimalPasswordLength ); - } - - return call_user_func_array( 'Status::newFatal', $valid ); + # check for password validity, return a fatal Status if invalid + $validity = $u->checkPasswordValidity( $this->mPassword ); + if ( !$validity->isGood() ) { + $validity->ok = false; // make sure this Status is fatal + return $validity; } } @@ -713,7 +710,11 @@ class LoginForm extends SpecialPage { } $u = User::newFromName( $this->mUsername ); + if ( $u === false ) { + return self::ILLEGAL; + } + $msg = null; // Give extensions a way to indicate the username has been updated, // rather than telling the user the account doesn't exist. if ( !Hooks::run( 'LoginUserMigrated', array( $u, &$msg ) ) ) { @@ -721,7 +722,7 @@ class LoginForm extends SpecialPage { return self::USER_MIGRATED; } - if ( !( $u instanceof User ) || !User::isUsableName( $u->getName() ) ) { + if ( !User::isUsableName( $u->getName() ) ) { return self::ILLEGAL; } @@ -739,7 +740,6 @@ class LoginForm extends SpecialPage { // Give general extensions, such as a captcha, a chance to abort logins $abort = self::ABORTED; - $msg = null; if ( !Hooks::run( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$msg ) ) ) { $this->mAbortLoginErrorMsg = $msg; @@ -765,7 +765,7 @@ class LoginForm extends SpecialPage { // As a side-effect, we can authenticate the user's e-mail ad- // dress if it's not already done, since the temporary password // was sent via e-mail. - if ( !$u->isEmailConfirmed() ) { + if ( !$u->isEmailConfirmed() && !wfReadOnly() ) { $u->confirmEmail(); $u->saveSettings(); }