Skip to content

Commit f1b6313

Browse files
committed
Define a custom script dataType converter, don't override the base one
The jquery upgrade from 2.2.4 to 3.7.1 from 16cf008 was causing a 401 unauthorized with sso enabled with kerberos to spin the login page because our script converter wasn't being run, therefore we weren't processing the response payload from the 401, which should update the page with the error, stop the spinner, and show the login fields. There were some changes in the 2.2.4 to 3.7.1 jquery upgrade that seems to conflict with our converter, perhaps our converter was being overridden, or maybe we need to override it differently. Either way, we can avoid this by defining our own converter. This was recreated locally via: render :inline => Rails.root.join("public/proxy_pages/invalid_sso_credentials.js").read, :content_type => "text/javascript", :status => 401 in kerberos_authenticate in dashboard_controller.rb and running this in the js console: await miqAjaxAuthSso('/dashboard/kerberos_authenticate?button=sso_login'); Here are the full set of changes for the upgrade: jquery/jquery@2.2.4...3.7.1
1 parent fbb9e40 commit f1b6313

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/javascript/oldjs/jquery_overrides.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $.ajaxSetup({
3636
return jQuery.parseJSON(text);
3737
});
3838
}),
39-
'text script': logError(function(text) {
39+
'text miq_script': logError(function(text) {
4040
if (text.match(/^{/)) {
4141
return jQuery.jsonPayload(text, function(text) {
4242
return text;

app/javascript/oldjs/miq_application.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,8 +1123,8 @@ window.miqJqueryRequest = function(url, options) {
11231123
};
11241124

11251125
if (options.dataType === undefined) {
1126-
ajax_options.accepts = { script: `*/*;q=0.5, ${$.ajaxSettings.accepts.script}` };
1127-
ajax_options.dataType = 'script';
1126+
ajax_options.accepts = { miq_script: `*/*;q=0.5, ${$.ajaxSettings.accepts.script}` };
1127+
ajax_options.dataType = 'miq_script';
11281128
}
11291129

11301130
// copy selected options over

0 commit comments

Comments
 (0)