diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2015-07-25 01:48:17 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2015-07-25 01:48:17 +0000 |
commit | 13028443ccddfa23c53ab652eb8a28a0ce29b32b (patch) | |
tree | 97cdd49c8bc6acb84c64473d954e9717f04a080f | |
parent | ca56f1fbc32529622cf430fe2ed44347b85e3c24 (diff) | |
parent | 5c50bb4caf947fd5aa934c1b83816bc460bd7cc5 (diff) | |
download | mediawikicore-13028443ccddfa23c53ab652eb8a28a0ce29b32b.tar.gz mediawikicore-13028443ccddfa23c53ab652eb8a28a0ce29b32b.zip |
Merge "HTMLForm: Allow IP adresses as username in HTMLUserTextField"
-rw-r--r-- | includes/htmlform/HTMLUserTextField.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/includes/htmlform/HTMLUserTextField.php b/includes/htmlform/HTMLUserTextField.php index 949fefd1e6c9..5869002b9523 100644 --- a/includes/htmlform/HTMLUserTextField.php +++ b/includes/htmlform/HTMLUserTextField.php @@ -17,6 +17,7 @@ class HTMLUserTextField extends HTMLTextField { public function __construct( $params ) { $params += array( 'exists' => false, + 'ipallowed' => false, ); parent::__construct( $params ); @@ -24,11 +25,14 @@ class HTMLUserTextField extends HTMLTextField { public function validate( $value, $alldata ) { // check, if a user exists with the given username - $user = User::newFromName( $value ); + $user = User::newFromName( $value, false ); if ( !$user ) { return $this->msg( 'htmlform-user-not-valid', $value )->parse(); - } elseif ( $this->mParams['exists'] && $user->getId() === 0 ) { + } elseif ( + ( $this->mParams['exists'] && $user->getId() === 0 ) && + !( $this->mParams['ipallowed'] && User::isIP( $value ) ) + ) { return $this->msg( 'htmlform-user-not-exists', $user->getName() )->parse(); } |