Gergő Tisza has uploaded a new change for review.
https://gerrit.wikimedia.org/r/258724
Change subject: Disable authorization form button after submit
......................................................................
Disable authorization form button after submit
Prevents double-posting which would fail the authorization
process since the OAuth server keeps track of used tokens.
Bug: T121287
Change-Id: Ie81c0a764c9f74e1e305292c7802b62c28712ddf
---
M frontend/modules/ext.MWOAuth.AuthorizeDialog.js
M frontend/specialpages/SpecialMWOAuth.php
2 files changed, 7 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth
refs/changes/24/258724/1
diff --git a/frontend/modules/ext.MWOAuth.AuthorizeDialog.js
b/frontend/modules/ext.MWOAuth.AuthorizeDialog.js
index d1a752f..7603d77 100644
--- a/frontend/modules/ext.MWOAuth.AuthorizeDialog.js
+++ b/frontend/modules/ext.MWOAuth.AuthorizeDialog.js
@@ -7,7 +7,8 @@
var mwoauth = {
'init': function () {
- var form = $( '#mw-mwoauth-authorize-dialog' );
+ var form = $( '#mw-mwoauth-authorize-dialog' ),
+ accept = $( '#mw-mwoauth-accept' );
form.find( '.mw-htmlform-submit-buttons' ).addClass(
'mw-ui-flush-right' );
form.dialog( {
dialogClass:
'mw-mwoauth-authorize-jQuery-dialog',
@@ -27,6 +28,9 @@
$( this ).dialog( 'option', 'modal',
true );
}
} );
+ form.submit( function() {
+ accept.prop( 'disabled', true );
+ } );
}
};
diff --git a/frontend/specialpages/SpecialMWOAuth.php
b/frontend/specialpages/SpecialMWOAuth.php
index b72fe7e..4248a82 100644
--- a/frontend/specialpages/SpecialMWOAuth.php
+++ b/frontend/specialpages/SpecialMWOAuth.php
@@ -391,7 +391,8 @@
$form->suppressDefaultSubmit();
$form->addButton( 'accept',
wfMessage( 'mwoauth-form-button-approve' )->text(),
null,
- array( 'class' => 'mw-mwoauth-authorize-button
mw-ui-button mw-ui-constructive' ) );
+ array( 'class' => 'mw-mwoauth-authorize-button
mw-ui-button mw-ui-constructive',
+ 'id' => 'mw-mwoauth-accept' ) );
$form->addButton( 'cancel',
wfMessage( 'mwoauth-form-button-cancel' )->text(), null,
array( 'class' => 'mw-mwoauth-authorize-button
mw-ui-button mw-ui-quiet' ) );
--
To view, visit https://gerrit.wikimedia.org/r/258724
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie81c0a764c9f74e1e305292c7802b62c28712ddf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits