# HG changeset patch
# User Dan
# Date 1242046207 14400
# Node ID dd8c53454f3141fe46a5455054f518c5394f0acd
# Parent e04c0f64e9722ab5fecdb283e41e81096664382b
Yubikey flags are no longer fetched from server at login time, instead provided with load
diff -r e04c0f64e972 -r dd8c53454f31 plugins/yubikey/corelib.php
--- 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('');
// 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('');
+ $template->add_header('');
}
diff -r e04c0f64e972 -r dd8c53454f31 plugins/yubikey/yubikey.js
--- 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();