Yubikey user CP now requires re-auth to CHPREF. Didn't win YubiKing :-(
authorDan
Thu, 19 Mar 2009 09:27:52 -0400
changeset 15 c479ca761d29
parent 14 800df1e3c69a
child 16 3163b9f58ae8
Yubikey user CP now requires re-auth to CHPREF. Didn't win YubiKing :-(
plugins/yubikey/usercp.php
--- a/plugins/yubikey/usercp.php	Thu Mar 19 09:21:56 2009 -0400
+++ b/plugins/yubikey/usercp.php	Thu Mar 19 09:27:52 2009 -0400
@@ -12,7 +12,7 @@
 
 function yubikey_ucp_setup()
 {
-  userprefs_menu_add('usercp_sec_profile', 'yubiucp_panel_title', makeUrlNS('Special', 'Preferences/Yubikey'));
+  userprefs_menu_add('usercp_sec_profile', 'yubiucp_panel_title', makeUrlNS('Special', 'Preferences/Yubikey') . '" onclick="ajaxLoginNavTo(\'Special\', \'Preferences/Yubikey\', '.USER_LEVEL_CHPREF.'); return false;');
 }
 
 function yubikey_user_cp($section)
@@ -23,6 +23,11 @@
   if ( $section !== 'Yubikey' )
     return false;
   
+  if ( $session->auth_level < USER_LEVEL_CHPREF )
+  {
+    redirect(makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . USER_LEVEL_CHPREF, true), 'Authentication required', 'You need to re-authenticate to access this page.', 0);
+  }
+  
   $count_enabled = intval(getConfig('yubikey_enroll_limit', '3'));
   
   if ( isset($_POST['submit']) )