10 $plugins->attachHook("ucp_register_validate", "yubikey_register_validate(\$error);"); |
10 $plugins->attachHook("ucp_register_validate", "yubikey_register_validate(\$error);"); |
11 $plugins->attachHook("user_registered", "yubikey_register_insert_key(\$user_id);"); |
11 $plugins->attachHook("user_registered", "yubikey_register_insert_key(\$user_id);"); |
12 |
12 |
13 function yubikey_ucp_setup() |
13 function yubikey_ucp_setup() |
14 { |
14 { |
15 userprefs_menu_add('usercp_sec_profile', 'yubiucp_panel_title', makeUrlNS('Special', 'Preferences/Yubikey')); |
15 userprefs_menu_add('usercp_sec_profile', 'yubiucp_panel_title', makeUrlNS('Special', 'Preferences/Yubikey') . '" onclick="ajaxLoginNavTo(\'Special\', \'Preferences/Yubikey\', '.USER_LEVEL_CHPREF.'); return false;'); |
16 } |
16 } |
17 |
17 |
18 function yubikey_user_cp($section) |
18 function yubikey_user_cp($section) |
19 { |
19 { |
20 global $db, $session, $paths, $template, $plugins; // Common objects |
20 global $db, $session, $paths, $template, $plugins; // Common objects |
21 global $lang; |
21 global $lang; |
22 |
22 |
23 if ( $section !== 'Yubikey' ) |
23 if ( $section !== 'Yubikey' ) |
24 return false; |
24 return false; |
|
25 |
|
26 if ( $session->auth_level < USER_LEVEL_CHPREF ) |
|
27 { |
|
28 redirect(makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . USER_LEVEL_CHPREF, true), 'Authentication required', 'You need to re-authenticate to access this page.', 0); |
|
29 } |
25 |
30 |
26 $count_enabled = intval(getConfig('yubikey_enroll_limit', '3')); |
31 $count_enabled = intval(getConfig('yubikey_enroll_limit', '3')); |
27 |
32 |
28 if ( isset($_POST['submit']) ) |
33 if ( isset($_POST['submit']) ) |
29 { |
34 { |