author | Dan |
Fri, 18 Dec 2009 19:28:57 -0500 | |
changeset 34 | 6e947fa21237 |
parent 27 | 647f0aa485dd |
child 37 | 5e946a3f405b |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
||
3 |
$plugins->attachHook('acp_general_users', 'yubikey_admin_cp_ui();'); |
|
4 |
$plugins->attachHook('acp_general_save', 'yubikey_admin_cp_save();'); |
|
5 |
||
6 |
function yubikey_admin_cp_ui() |
|
7 |
{ |
|
8 |
global $lang; |
|
9 |
?> |
|
10 |
<tr> |
|
11 |
<th colspan="2" class="subhead"> |
|
12 |
<?php echo $lang->get('yubiacp_th'); ?> |
|
13 |
</th> |
|
14 |
</tr> |
|
15 |
||
16 |
<tr> |
|
17 |
<td class="row1"> |
|
18 |
<?php echo $lang->get('yubiacp_field_enable_title'); ?> |
|
19 |
</td> |
|
20 |
<td class="row1"> |
|
21 |
<label> |
|
22 |
<input type="checkbox" name="yubikey_enable" <?php if ( getConfig('yubikey_enable', '1') == '1' ) echo 'checked="checked" '; ?>/> |
|
23 |
<?php echo $lang->get('yubiacp_field_enable'); ?> |
|
24 |
</label> |
|
25 |
</td> |
|
26 |
</tr> |
|
27 |
||
28 |
<tr> |
|
29 |
<td class="row2"> |
|
30 |
<?php echo $lang->get('yubiacp_field_api_key'); ?> |
|
31 |
</td> |
|
32 |
<td class="row2"> |
|
33 |
<input type="text" name="yubikey_api_key" value="<?php echo htmlspecialchars(getConfig('yubikey_api_key', '')); ?>" size="30" /> |
|
34 |
</td> |
|
35 |
</tr> |
|
36 |
||
37 |
<tr> |
|
38 |
<td class="row1"> |
|
39 |
<?php echo $lang->get('yubiacp_field_api_key_id'); ?> |
|
40 |
</td> |
|
41 |
<td class="row1"> |
|
42 |
<input type="text" name="yubikey_api_key_id" value="<?php echo strval(intval(getConfig('yubikey_api_key_id', ''))); ?>" size="5" /> |
|
43 |
</td> |
|
44 |
</tr> |
|
45 |
||
46 |
<tr> |
|
47 |
<td class="row2"> |
|
48 |
<?php echo $lang->get('yubiacp_field_auth_server'); ?> |
|
49 |
</td> |
|
50 |
<td class="row2"> |
|
51 |
<input type="text" name="yubikey_auth_server" value="<?php echo htmlspecialchars(getConfig('yubikey_auth_server', YK_DEFAULT_VERIFY_URL)); ?>" size="30" /> |
|
27 | 52 |
<?php |
53 |
if ( defined('YMS_INSTALLED') ) |
|
54 |
{ |
|
55 |
echo '<br />'; |
|
56 |
echo $lang->get('yubiacp_field_use_local_pre'); |
|
57 |
?> <label><input type="checkbox" name="yubikey_use_local_yms" <?php echo getConfig('yubikey_use_local_yms', 0) ? 'checked="checked" ' : ''; ?>/><?php |
|
58 |
echo $lang->get('yubiacp_field_use_local'); |
|
59 |
echo '</label>'; |
|
60 |
} |
|
61 |
?> |
|
0 | 62 |
</td> |
63 |
</tr> |
|
64 |
||
65 |
<tr> |
|
66 |
<td class="row1"> |
|
67 |
<?php echo $lang->get('yubiacp_field_enroll_limit'); ?> |
|
68 |
</td> |
|
69 |
<td class="row1"> |
|
70 |
<input type="text" name="yubikey_enroll_limit" value="<?php echo strval(intval(getConfig('yubikey_enroll_limit', '3'))); ?>" size="5" /> |
|
71 |
</td> |
|
72 |
</tr> |
|
73 |
||
8
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
74 |
<tr> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
75 |
<td class="row2"> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
76 |
<?php echo $lang->get('yubiacp_field_reg_require_otp_title'); ?><br /> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
77 |
<small><?php echo $lang->get('yubiacp_field_reg_require_otp_hint'); ?></small> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
78 |
</td> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
79 |
<td class="row2"> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
80 |
<label> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
81 |
<input type="checkbox" name="yubikey_reg_require_otp" <?php if ( getConfig('yubikey_reg_require_otp', '0') == '1' ) echo 'checked="checked" '; ?>/> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
82 |
<?php echo $lang->get('yubiacp_field_reg_require_otp'); ?> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
83 |
</label> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
84 |
</td> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
85 |
</tr> |
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
86 |
|
0 | 87 |
<?php |
88 |
} |
|
89 |
||
90 |
function yubikey_admin_cp_save() |
|
91 |
{ |
|
92 |
global $lang; |
|
93 |
||
94 |
// yubikey_enable, yubikey_api_key, yubikey_api_key_id, yubikey_auth_server, yubikey_enroll_limit |
|
95 |
setConfig('yubikey_enable', isset($_POST['yubikey_enable']) ? '1' : '0'); |
|
96 |
setConfig('yubikey_api_key', $_POST['yubikey_api_key']); |
|
97 |
setConfig('yubikey_api_key_id', intval($_POST['yubikey_api_key_id'])); |
|
98 |
setConfig('yubikey_enroll_limit', intval($_POST['yubikey_enroll_limit'])); |
|
8
032ca892b9a2
Added option to enroll Yubikey during registration + option in admin CP to require enrollment
Dan
parents:
0
diff
changeset
|
99 |
setConfig('yubikey_reg_require_otp', isset($_POST['yubikey_reg_require_otp']) ? '1' : '0'); |
27 | 100 |
setConfig('yubikey_use_local_yms', isset($_POST['yubikey_use_local_yms']) && defined('YMS_INSTALLED') ? '1' : '0'); |
0 | 101 |
|
102 |
if ( preg_match('#^(?:https?://)?(\[?[a-z0-9-:]+(?:\.[a-z0-9-:]+\]?)*)(/.*)$#', $_POST['yubikey_auth_server']) ) |
|
103 |
setConfig('yubikey_auth_server', $_POST['yubikey_auth_server']); |
|
104 |
else |
|
105 |
echo '<div class="error-box">' . $lang->get('yubiacp_err_invalid_auth_server') . '</div>'; |
|
106 |
} |
|
107 |