Skip to content

Commit

Permalink
Revert "[BUGFIX] Simulate submit button for rsaauth form submit"
Browse files Browse the repository at this point in the history
This reverts commit 0483c4a.

This change caused a regression which basically affected users of Mozilla
Firefox - details are described in issue #84503. Besides that the initial
bug report address the frontend part, changing backend login behavior was
not required in order for the bug fix.

RsaEncryptionWithLib.min.js could not be reverted directly due to newer
conflicting changes for the same file - it has been re-compiled from the
according source files using the following uglify command:

    ../../../../../../Build/node_modules/uglify-js/bin/uglifyjs \
    RsaLibrary.js RsaEncryption.js > RsaEncryptionWithLib.min.js

Releases: master, 8.7, 7.6
Resolves: #84503
Reverts: #76120
Change-Id: I45fe6086afa48eed71be635e8cf4a1f3fa138ab2
Reviewed-on: https://review.typo3.org/56394
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
  • Loading branch information
ohader authored and susannemoog committed Mar 21, 2018
1 parent 02cfe45 commit 00b134a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
Expand Up @@ -120,12 +120,15 @@
}

// Submit the form again but now with encrypted values
for (var j = rsaEncryption.form.elements.length; j--;) {
var submitField = rsaEncryption.form.elements[j];
if ((['input', 'button'].indexOf(submitField.nodeName.toLowerCase()) > -1)
&& (['submit', 'image', 'button'].indexOf(submitField.type.toLowerCase()) > -1)
) {
submitField.click();
var form = document.createElement('form');
if (form.submit.call) {
form.submit.call(rsaEncryption.form);
} else {
for (var j = rsaEncryption.form.elements.length; j--;) {
var submitField = rsaEncryption.form.elements[j];
if (submitField.nodeName.toLowerCase() === 'input' && submitField.type === "submit") {
submitField.click();
}
}
}
};
Expand Down
Expand Up @@ -114,22 +114,12 @@ define(['jquery', './RsaLibrary'], function($) {
});

// Try to fetch the field which submitted the form
var $currentField = RsaEncryption.$currentForm.find('input[type=submit]:focus,input[type=image]:focus,button:focus');
var $currentField = RsaEncryption.$currentForm.find('input[type=submit]:focus,input[type=image]:focus');
if ($currentField.length === 1) {
$currentField.trigger('click');
} else {
// Create a hidden input field to fake pressing the submit button
var name = 'commandLI',
value = 'Submit';
var $submitField = RsaEncryption.$currentForm.find('input[type=submit],input[type=image],input[type=button],button[name][type=submit]').first();
if ($submitField.length === 1) {
name = $submitField.attr('name') || name;
value = $submitField.attr('value') || value ;
}
var $hiddenField = $('<input type="hidden">')
.attr('name', name)
.val(value);
RsaEncryption.$currentForm.append($hiddenField);
RsaEncryption.$currentForm.append('<input type="hidden" name="commandLI" value="Submit">');

// Restore the original submit handler
var originalOnSubmit = RsaEncryption.$currentForm.data('original-onsubmit');
Expand Down

0 comments on commit 00b134a

Please sign in to comment.