diff options
author | jim-p <jimp@pfsense.org> | 2010-05-28 16:12:08 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2010-05-28 16:13:29 -0400 |
commit | 23e95c1a265382d6585328b71b12b040cac7f4e3 (patch) | |
tree | 7b091af5e0564f3521e31924bb48e35e4423afbe /usr/local/www/vpn_ipsec_keys_edit.php | |
parent | 66a72c9f60adbd38d2054f137b9576335d941f01 (diff) | |
download | pfsense-23e95c1a265382d6585328b71b12b040cac7f4e3.zip pfsense-23e95c1a265382d6585328b71b12b040cac7f4e3.tar.gz |
Don't let someone add a custom PSK that conflicts with an existing username. While here, style formfields appropriately.
Diffstat (limited to 'usr/local/www/vpn_ipsec_keys_edit.php')
-rw-r--r-- | usr/local/www/vpn_ipsec_keys_edit.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr/local/www/vpn_ipsec_keys_edit.php b/usr/local/www/vpn_ipsec_keys_edit.php index 6e0db5b..20ac6c0 100644 --- a/usr/local/www/vpn_ipsec_keys_edit.php +++ b/usr/local/www/vpn_ipsec_keys_edit.php @@ -56,6 +56,10 @@ if (isset($id) && $a_secret[$id]) { } if ($_POST) { + $userids = array(); + foreach ($config['system']['user'] as $id => $user) { + $userids[$user['name']] = $id; + } unset($input_errors); $pconfig = $_POST; @@ -68,6 +72,9 @@ if ($_POST) { if (preg_match("/[^a-zA-Z0-9@\.\-]/", $_POST['ident'])) $input_errors[] = "The identifier contains invalid characters."; + + if (array_key_exists($_POST['ident'], $userids)) + $input_errors[] = "A user with this name already exists. Add the key to the user instead."; if (!$input_errors && !(isset($id) && $a_secret[$id])) { /* make sure there are no dupes */ @@ -117,7 +124,7 @@ include("head.inc"); <tr> <td valign="top" class="vncellreq">Identifier</td> <td class="vtable"> - <?=$mandfldhtml;?><input name="ident" type="text" class="formfld" id="ident" size="30" value="<?=$pconfig['ident'];?>"> + <?=$mandfldhtml;?><input name="ident" type="text" class="formfld unknown" id="ident" size="30" value="<?=$pconfig['ident'];?>"> <br> This can be either an IP address, fully qualified domain name or an e-mail address. </td> @@ -125,7 +132,7 @@ This can be either an IP address, fully qualified domain name or an e-mail addre <tr> <td width="22%" valign="top" class="vncellreq">Pre-shared key</td> <td width="78%" class="vtable"> - <?=$mandfldhtml;?><input name="psk" type="text" class="formfld" id="psk" size="40" value="<?=htmlspecialchars($pconfig['psk']);?>"> + <?=$mandfldhtml;?><input name="psk" type="text" class="formfld unknown" id="psk" size="40" value="<?=htmlspecialchars($pconfig['psk']);?>"> </td> </tr> <tr> |