diff --git a/includes/configure_client.php b/includes/configure_client.php index 64164f947..41da0716f 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -77,6 +77,15 @@ function DisplayWPAConfig() } } } + } elseif (strlen($network['passphrase']) == 0 && strlen($network['passkey']) == 64) { + $line = "\tpsk=" . $network['passkey']; + fwrite($wpa_file, "network={".PHP_EOL); + fwrite($wpa_file, "\tssid=\"".$ssid."\"".PHP_EOL); + fwrite($wpa_file, $line.PHP_EOL); + if (array_key_exists('priority', $network)) { + fwrite($wpa_file, "\tpriority=".$network['priority'].PHP_EOL); + } + fwrite($wpa_file, "}".PHP_EOL); } else { $status->addMessage('WPA passphrase must be between 8 and 63 characters', 'danger'); $ok = false; diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 34f8bc580..1ef0e2253 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -27,9 +27,9 @@ function knownWifiStations(&$networks) $network['ssid'] = $ssid; break; case 'psk': - if (array_key_exists('passphrase', $network)) { - break; - } + $network['passkey'] = trim($lineArr[1]); + $network['protocol'] = 'WPA'; + break; case '#psk': $network['protocol'] = 'WPA'; case 'wep_key0': // Untested