Florianschmidtwelzow has uploaded a new change for review.
https://gerrit.wikimedia.org/r/226741
Change subject: HTMLForm: Allow IP adresses as username in HTMLUserTextField
......................................................................
HTMLForm: Allow IP adresses as username in HTMLUserTextField
Can be configured with the 'ipallowed' config parameter, which defaults
to false (IP's not allowed).
Bug: T106807
Change-Id: Ib2885883bdb3383c60382bf3257afdfc3cc26821
---
M includes/htmlform/HTMLUserTextField.php
1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/41/226741/1
diff --git a/includes/htmlform/HTMLUserTextField.php
b/includes/htmlform/HTMLUserTextField.php
index 949fefd..5869002 100644
--- a/includes/htmlform/HTMLUserTextField.php
+++ b/includes/htmlform/HTMLUserTextField.php
@@ -17,6 +17,7 @@
public function __construct( $params ) {
$params += array(
'exists' => false,
+ 'ipallowed' => false,
);
parent::__construct( $params );
@@ -24,11 +25,14 @@
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();
}
--
To view, visit https://gerrit.wikimedia.org/r/226741
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib2885883bdb3383c60382bf3257afdfc3cc26821
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits