(submitValue)
| 1 | function submitConsentForm(submitValue) { |
| 2 | var grantScope = document.querySelectorAll( |
| 3 | 'input[name="grant_scope"]:checked', |
| 4 | ); |
| 5 | var grantScopeValues = []; |
| 6 | for (var i = 0; i < grantScope.length; i++) { |
| 7 | grantScopeValues.push(grantScope[i].value); |
| 8 | } |
| 9 | |
| 10 | var challenge = document.querySelector('input[name="challenge"]').value; |
| 11 | var csrfToken = document.querySelector('input[name="csrfToken"]').value; |
| 12 | var data = { |
| 13 | grant_scope: grantScopeValues, |
| 14 | submit: submitValue, |
| 15 | challenge: challenge, |
| 16 | csrfToken: csrfToken, |
| 17 | }; |
| 18 | var xhr = new XMLHttpRequest(); |
| 19 | xhr.open("POST", "/oauth2/consent"); |
| 20 | xhr.setRequestHeader("Content-Type", "application/json"); |
| 21 | xhr.onload = function () { |
| 22 | if (xhr.status === 200) { |
| 23 | window.location.href = JSON.parse(xhr.responseText).redirectTo; |
| 24 | } else { |
| 25 | alert("Something went wrong"); |
| 26 | } |
| 27 | }; |
| 28 | xhr.send(JSON.stringify(data)); |
| 29 | } |
| 30 | |
| 31 | function attachFormHandler() { |
| 32 | var form = document.querySelector("form"); |
no test coverage detected