Florianschmidtwelzow has submitted this change and it was merged.

Change subject: Fix GoogleLogin button creation for Special:UserLogin
......................................................................


Fix GoogleLogin button creation for Special:UserLogin

HTMLForm::setAction changes the action of the form html element, but
not the hidden title input. If a request parameter is set in the URL
(GET) and send with POST (which is the method used for the Googlelogin
HTMLForm), the value of the global $_POST variable is used in WebRequest.
Because of that, the hidden title element of the form is observed when
the request is processed by MediaWiki, which is Special:UserLogin, even
if the GET value is Special:GoogleLogin. This results in the weird behaviour,
that in the URL the user sees Special:GoogleLogin but gets the contents
of Special:UserLogin.

This commit changes the way how the action is set to the HTMLForm. Instead
of using setAction, it now uses setTitle to set the correct context for
the HTMLForm.

Bug: T134504
Change-Id: I0d56b1634bf7657101b5c61ac2a50ed692276fb5
---
M includes/GoogleLogin.body.php
1 file changed, 8 insertions(+), 9 deletions(-)

Approvals:
  Florianschmidtwelzow: Verified; Looks good to me, approved



diff --git a/includes/GoogleLogin.body.php b/includes/GoogleLogin.body.php
old mode 100644
new mode 100755
index b9e6a62..8c949ef
--- a/includes/GoogleLogin.body.php
+++ b/includes/GoogleLogin.body.php
@@ -583,15 +583,14 @@
                // create a separate vform above the "normal" user login form
                // this could be converted to ooui, after the core login form 
uses ooui elements and styling
                $htmlForm = HTMLForm::factory( 'vform', $fields, 
$tpl->getSkin()->getContext() );
-               // we don't need (and want) a separate submit button
-               $htmlForm->suppressDefaultSubmit();
-               $htmlForm->setId( 'googleloginForm' );
-               // the target isn't Special:UserLogin, set it to be 
Special:GoogleLogin
-               $htmlForm->setAction( SpecialPage::getTitleFor( 'GoogleLogin' 
)->getLocalUrl() );
-               // add hidden fields
-               $htmlForm->addHiddenFields( $hiddenFields );
-               // show the form
-               $htmlForm->prepareForm()->displayForm( false );
+
+               $htmlForm
+                       ->suppressDefaultSubmit()
+                       ->setId( 'googleloginForm' )
+                       ->setTitle( SpecialPage::getTitleFor( 'GoogleLogin' ) )
+                       ->addHiddenFields( $hiddenFields )
+                       ->prepareForm()
+                       ->displayForm( false );
 
                // if the form is above the login form, show a separator
                if ( !$showRight ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/287123
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d56b1634bf7657101b5c61ac2a50ed692276fb5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GoogleLogin
Gerrit-Branch: REL1_26
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to