Skip to content

Commit

Permalink
fix: dynamically cleared out fields
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvanshus-crest committed Jun 16, 2021
1 parent deb2a54 commit d12a970
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ui/src/main/webapp/components/BaseFormView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,6 @@ class BaseFormView extends PureComponent {
this.isOAuth &&
(this.isSingleOauth || (this.isAuthVal && this.datadict.auth_type === 'oauth'))
) {
// clear out Basic Authentication fields before doing OAuth Authentication
this.datadict.username = '';
this.datadict.password = '';
// handle oauth Authentication
// Populate the parameter string with client_id, redirect_url and response_type
let parameters = `?response_type=code&client_id=${this.datadict.client_id}&redirect_uri=${this.datadict.redirect_url}`;
Expand Down Expand Up @@ -572,9 +569,6 @@ class BaseFormView extends PureComponent {
}
});
} else {
// clear out OAuth Authentication fields before doing Basic Authentication
this.datadict.client_id = '';
this.datadict.client_secret = '';
this.saveData();
}
};
Expand All @@ -599,6 +593,17 @@ class BaseFormView extends PureComponent {
}
});

// clear out fields of other authentication methods when using one
if (this.isAuthVal) {
Object.keys(this.authMap).forEach((type) => {
if (this.datadict.auth_type !== type) {
this.authMap[type].forEach((e) => {
body.set(e, '');
});
}
});
}

if (this.isOAuth) {
// Prevent passing redirect_url field used in OAuth to backend conf file
body.delete('redirect_url');
Expand Down

0 comments on commit d12a970

Please sign in to comment.