If yubikey_reg_require_otp is 1, opening login window now auto-opens Yubikey prompt
authorDan
Mon, 02 Mar 2009 10:56:51 -0500
changeset 9 65965da01c41
parent 8 032ca892b9a2
child 10 748fa1b80031
If yubikey_reg_require_otp is 1, opening login window now auto-opens Yubikey prompt
plugins/yubikey/corelib.php
plugins/yubikey/yubikey.js
--- a/plugins/yubikey/corelib.php	Sun Mar 01 21:45:44 2009 -0500
+++ b/plugins/yubikey/corelib.php	Mon Mar 02 10:56:51 2009 -0500
@@ -177,5 +177,7 @@
   
   $template->add_header('<script type="text/javascript" src="' . scriptPath . '/plugins/yubikey/yubikey.js"></script>');
   $template->add_header('<link rel="stylesheet" type="text/css" href="' . scriptPath . '/plugins/yubikey/yubikey.css" />');
+  // config option for all users have yubikey
+  $template->add_header('<script type="text/javascript">var yk_reg_require_otp = ' . getConfig('yubikey_reg_require_otp', '0') . '</script>');
 }
 
--- a/plugins/yubikey/yubikey.js	Sun Mar 01 21:45:44 2009 -0500
+++ b/plugins/yubikey/yubikey.js	Mon Mar 02 10:56:51 2009 -0500
@@ -252,6 +252,13 @@
       $('#messageBoxButtons input:button:first').focus();
       $('#ajax_login_field_captcha').focus();
     });
+  if ( window.yk_reg_require_otp )
+  {
+    setTimeout(function()
+      {
+        yk_mb_init(yk_login_validate_reqs);
+      }, 750);
+  }
   tr.appendChild(td);
   table.appendChild(tr);
 }