From f805ef74d0887851a885b0b680ae16deb2e7c47d Mon Sep 17 00:00:00 2001 From: tonythomas01 <01tonythomas@gmail.com> Date: Tue, 28 Jan 2014 19:01:48 +0530 Subject: [PATCH] Changed the password $valid check condition $user will always be an object and User::getPasswordValidity will always return either true, a string or a (non-empty) array combined with AND (&&), this will always be true" Removed message 'config-admin-password-same' as it was used nowhere. Bug: 41392 Change-Id: Idc2cb80ca4541d1120e18aad3261aece7bd72122 --- includes/installer/Installer.i18n.php | 1 - includes/installer/WebInstallerPage.php | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php index 892fb2af0f..3b3205f3fd 100644 --- a/includes/installer/Installer.i18n.php +++ b/includes/installer/Installer.i18n.php @@ -377,7 +377,6 @@ This is the name you will use to log in to the wiki.', 'config-admin-name-invalid' => 'The specified username "$1" is invalid. Specify a different username.', 'config-admin-password-blank' => 'Enter a password for the administrator account.', - 'config-admin-password-same' => 'The password must not be the same as the username.', 'config-admin-password-mismatch' => 'The two passwords you entered do not match.', 'config-admin-email' => 'Email address:', 'config-admin-email-help' => 'Enter an email address here to allow you to receive email from other users on the wiki, reset your password, and be notified of changes to pages on your watchlist. You can leave this field empty.', diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index d4b3d65713..7b8b97b1e8 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -827,7 +827,11 @@ class WebInstaller_Name extends WebInstallerPage { $msg = false; $pwd = $this->getVar( '_AdminPassword' ); $user = User::newFromName( $cname ); - $valid = $user && $user->getPasswordValidity( $pwd ); + if ( $user ) { + $valid = $user->getPasswordValidity( $pwd ); + } else { + $valid = 'config-admin-name-invalid'; + } if ( strval( $pwd ) === '' ) { # $user->getPasswordValidity just checks for $wgMinimalPasswordLength. # This message is more specific and helpful. @@ -835,8 +839,6 @@ class WebInstaller_Name extends WebInstallerPage { } elseif ( $pwd !== $this->getVar( '_AdminPassword2' ) ) { $msg = 'config-admin-password-mismatch'; } elseif ( $valid !== true ) { - # As of writing this will only catch the username being e.g. 'FOO' and - # the password 'foo' $msg = $valid; } if ( $msg !== false ) { -- 2.20.1