KaiRo bug 412 - Use composer to load oauth2-server-php and doctrine DBAL
[authserver.git] / app / authsystem.js
index 7a24d84af4b5efde87be187e217d3256c78ffedf..6ab6a14e9564e34ea772dd9030ec1886b096de78 100644 (file)
@@ -2,7 +2,11 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-window.onload = function() {
+// Call initElements at the earliest possible stage after parsing the document.
+if (window.addEventListener) { window.addEventListener("DOMContentLoaded", initElements, false); }
+else { window.onload = initElements(); }
+
+function initElements() {
   var jsWarning = document.getElementById("jswarning");
   if (jsWarning) {
     if (jsWarning.classList) {
@@ -27,7 +31,7 @@ window.onload = function() {
   if (cancelAuth) {
     cancelAuth.onclick = function() {
       document.getElementById("isauthorized").value = "no";
-      document.getElementById("loginauthform").submit();
+      document.getElementById("authform").submit();
     }
   }
   var addAnotherEmail = document.getElementById("addanotheremail");