r65699 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65698‎ | r65699 | r65700 >
Date:16:12, 30 April 2010
Author:avar
Status:ok
Tags:
Comment:
Use User::getPasswordValidity in addition to the custom new-installer hacks

$pwd === $cname is guaranteed to fail because we disallow lc($pwd) eq
lc($cname) later in getPasswordValidity() when creating the account.

Drop that check and just outsource our check to getPasswordValidity's
more accurate check.
Modified paths:
  • /branches/new-installer/phase3/includes/installer/WebInstaller.php (modified) (history)

Diff [purge]

Index: branches/new-installer/phase3/includes/installer/WebInstaller.php
@@ -1270,12 +1270,18 @@
12711271 // Validate password
12721272 $msg = false;
12731273 $pwd = $this->getVar( '_AdminPassword' );
 1274+ $user = User::newFromName( $cname );
 1275+ $valid = $user->getPasswordValidity( $pwd );
12741276 if ( strval( $pwd ) === '' ) {
 1277+ # $user->getPasswordValidity just checks for $wgMinimalPasswordLength.
 1278+ # This message is more specific and helpful.
12751279 $msg = 'config-admin-password-blank';
1276 - } elseif ( $pwd === $cname ) {
1277 - $msg = 'config-admin-password-same';
12781280 } elseif ( $pwd !== $this->getVar( '_AdminPassword2' ) ) {
12791281 $msg = 'config-admin-password-mismatch';
 1282+ } elseif ( $valid !== true ) {
 1283+ # As of writing this will only catch the username being e.g. 'FOO' and
 1284+ # the password 'foo'
 1285+ $msg = $valid;
12801286 }
12811287 if ( $msg !== false ) {
12821288 $this->parent->showError( $msg );

Status & tagging log