mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 23:04:51 +02:00
loader.js: Don't consider redirected form submits as auto submits
A redirect caused by a form submit is **never** an automatic submit. Unless I'm missing something here. There is one way this may be true, as ipl forms without a submit button are indeed successful due to a autosubmit element, but they don't redirect by default. So if the controller redirects in such a case, the form should have a submit button, I guess.. Anyway, this is necessary due to the previous commit as this may otherwise cause form submits, that re-render layout during a redirect, are considered being auto submitted. (Such as the login form)
This commit is contained in:
parent
4743c5f5c8
commit
30b540952a
@ -790,14 +790,9 @@
|
|||||||
this.icinga.ui.setWindowId(windowId);
|
this.icinga.ui.setWindowId(windowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
var referrer = req.referrer;
|
|
||||||
if (typeof referrer === 'undefined') {
|
|
||||||
referrer = req;
|
|
||||||
}
|
|
||||||
|
|
||||||
var autoSubmit = false;
|
var autoSubmit = false;
|
||||||
var currentUrl = this.icinga.utils.parseUrl(req.$target.data('icingaUrl'));
|
var currentUrl = this.icinga.utils.parseUrl(req.$target.data('icingaUrl'));
|
||||||
if (referrer.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
var newUrl = this.icinga.utils.parseUrl(req.url);
|
var newUrl = this.icinga.utils.parseUrl(req.url);
|
||||||
if (newUrl.path === currentUrl.path && this.icinga.utils.arraysEqual(newUrl.params, currentUrl.params)) {
|
if (newUrl.path === currentUrl.path && this.icinga.utils.arraysEqual(newUrl.params, currentUrl.params)) {
|
||||||
autoSubmit = true;
|
autoSubmit = true;
|
||||||
@ -817,7 +812,7 @@
|
|||||||
let url = currentUrl.path + (locationQuery ? '?' + locationQuery : '');
|
let url = currentUrl.path + (locationQuery ? '?' + locationQuery : '');
|
||||||
if (req.autosubmit || autoSubmit) {
|
if (req.autosubmit || autoSubmit) {
|
||||||
// Also update a form's action if it doesn't differ from the container's url
|
// Also update a form's action if it doesn't differ from the container's url
|
||||||
var $form = $(referrer.forceFocus).closest('form');
|
var $form = $(req.forceFocus).closest('form');
|
||||||
var formAction = $form.attr('action');
|
var formAction = $form.attr('action');
|
||||||
if (!! formAction) {
|
if (!! formAction) {
|
||||||
formAction = this.icinga.utils.parseUrl(formAction);
|
formAction = this.icinga.utils.parseUrl(formAction);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user