aboutsummaryrefslogtreecommitdiff
path: root/connector/src/test/resources/config/webcontent/js
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2019-12-11 12:45:58 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2019-12-11 12:45:58 +0100
commit3734d910935f34427632a36206aa3b6b0822c9bf (patch)
tree4a834c00ea143eb331ae633d847e47a051408a17 /connector/src/test/resources/config/webcontent/js
parent7bdb891ffe9e14e86b23a10579c8d97759ba4830 (diff)
downloadNational_eIDAS_Gateway-3734d910935f34427632a36206aa3b6b0822c9bf.tar.gz
National_eIDAS_Gateway-3734d910935f34427632a36206aa3b6b0822c9bf.tar.bz2
National_eIDAS_Gateway-3734d910935f34427632a36206aa3b6b0822c9bf.zip
fix LoA level validation error in AuthnRequestValidator.java
Diffstat (limited to 'connector/src/test/resources/config/webcontent/js')
-rw-r--r--connector/src/test/resources/config/webcontent/js/js_country.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/connector/src/test/resources/config/webcontent/js/js_country.js b/connector/src/test/resources/config/webcontent/js/js_country.js
new file mode 100644
index 00000000..5dcea90e
--- /dev/null
+++ b/connector/src/test/resources/config/webcontent/js/js_country.js
@@ -0,0 +1,42 @@
+function clickCountryFlag(element) {
+ if (!element) return false;
+
+ var form = element.target.closest("form");
+
+ if (!form) return false;
+
+ form.submit();
+ return false;
+}
+
+
+/* Set JS events by EventListener to prevent problems with CSP*/
+document.addEventListener("DOMContentLoaded", function(event) {
+
+ /* Element.closest polyfill - https://developer.mozilla.org/en-US/docs/Web/API/Element/closest License: public domain*/
+ if (!Element.prototype.matches)
+ Element.prototype.matches = Element.prototype.msMatchesSelector ||
+ Element.prototype.webkitMatchesSelector;
+
+ if (!Element.prototype.closest)
+ Element.prototype.closest = function(s) {
+ var el = this;
+ if (!document.documentElement.contains(el)) return null;
+ do {
+ if (el.matches(s)) return el;
+ el = el.parentElement || el.parentNode;
+ } while (el !== null && el.nodeType === 1);
+ return null;
+ };
+
+ /* set Click events by EventListener to prevent JavaScript in HTML which can be a problem with CSP*/
+ var allFlags = document.getElementsByClassName("countryimage");
+ for (i=0;i<allFlags.length;i++) {
+ if(allFlags[i].getAttribute("disabled") == null) {
+ allFlags[i].closest("a").addEventListener('click', clickCountryFlag, false);
+ }
+ }
+});
+
+
+