mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 02:48:18 +00:00
Ensure form tokens are not longer than allowed
Bug: T295940 Change-Id: I4e3fd5d3ef21274b104c4d22e3bab11043d61334
This commit is contained in:
parent
45ef474109
commit
72f806829c
|
@ -533,7 +533,9 @@ ReplyWidget.prototype.afterSetup = function () {
|
|||
ReplyWidget.prototype.getFormToken = function () {
|
||||
var formToken = this.storage.get( this.storagePrefix + '/formToken' );
|
||||
if ( !formToken ) {
|
||||
formToken = Math.random().toString( 36 ).slice( 2 );
|
||||
// See ApiBase::PARAM_MAX_CHARS in ApiDiscussionToolsEdit.php
|
||||
var maxLength = 16;
|
||||
formToken = Math.random().toString( 36 ).slice( 2, maxLength + 2 );
|
||||
this.storage.set( this.storagePrefix + '/formToken', formToken );
|
||||
}
|
||||
return formToken;
|
||||
|
|
Loading…
Reference in a new issue