$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
'config-admin-name-invalid' => 'The specified username "<nowiki>$1</nowiki>" 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.',
$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.
} 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 ) {