Yubikey flags are no longer fetched from server at login time, instead provided with load
--- a/plugins/yubikey/corelib.php Thu Apr 30 16:11:40 2009 -0400
+++ b/plugins/yubikey/corelib.php Mon May 11 08:50:07 2009 -0400
@@ -231,16 +231,17 @@
$template->add_header('<link rel="stylesheet" type="text/css" href="' . scriptPath . '/plugins/yubikey/yubikey.css" />');
// config option for all users have yubikey
$user_flags = 0;
+ $yk_enabled = 0;
if ( $session->user_logged_in )
{
- $q = $db->sql_query('SELECT COUNT(yubi_uid) > 0 FROM ' . table_prefix . "yubikey WHERE user_id = {$session->user_id};");
+ $q = $db->sql_query('SELECT COUNT(y.yubi_uid) > 0, u.user_yubikey_flags FROM ' . table_prefix . "yubikey AS y LEFT JOIN " . table_prefix . "users AS u ON ( u.user_id = y.user_id ) WHERE y.user_id = {$session->user_id};");
if ( !$q )
$db->_die();
- list($user_flags) = $db->fetchrow_num();
+ list($yk_enabled, $user_flags) = $db->fetchrow_num();
$db->free_result();
}
- $template->add_header('<script type="text/javascript">var yk_reg_require_otp = ' . getConfig('yubikey_reg_require_otp', '0') . '; var yk_user_enabled = ' . $user_flags . ';</script>');
+ $template->add_header('<script type="text/javascript">var yk_reg_require_otp = ' . getConfig('yubikey_reg_require_otp', '0') . '; var yk_user_enabled = ' . $yk_enabled . '; var yk_user_flags = ' . $user_flags . ';</script>');
}
--- a/plugins/yubikey/yubikey.js Thu Apr 30 16:11:40 2009 -0400
+++ b/plugins/yubikey/yubikey.js Mon May 11 08:50:07 2009 -0400
@@ -154,13 +154,13 @@
// login window is open
if ( user_level == USER_LEVEL_GUEST )
{
- var show_username = response.flags & YK_SEC_NORMAL_USERNAME;
- var show_password = response.flags & YK_SEC_NORMAL_PASSWORD;
+ var show_username = window.yk_user_flags & YK_SEC_NORMAL_USERNAME;
+ var show_password = window.yk_user_flags & YK_SEC_NORMAL_PASSWORD;
}
else
{
- var show_username = response.flags & YK_SEC_ELEV_USERNAME;
- var show_password = response.flags & YK_SEC_ELEV_PASSWORD;
+ var show_username = window.yk_user_flags & YK_SEC_ELEV_USERNAME;
+ var show_password = window.yk_user_flags & YK_SEC_ELEV_PASSWORD;
}
if ( !show_username )
$('#ajax_login_field_username').parent('td').hide().prev().hide();