mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-19 23:15:05 +00:00
Fix for open Wi-Fi (#387)
Don't encrypt password if there's no password set
This commit is contained in:
parent
1450ca319d
commit
09f8031bff
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
## Before release
|
## Before release
|
||||||
|
|
||||||
- Fix Wi-Fi password(less) decryption crash
|
|
||||||
- Make better esp_lcd driver (and test all devices)
|
- Make better esp_lcd driver (and test all devices)
|
||||||
|
|
||||||
## Higher Priority
|
## Higher Priority
|
||||||
|
|||||||
@ -132,7 +132,10 @@ bool load(const std::string& ssid, WifiApSettings& apSettings) {
|
|||||||
|
|
||||||
if (map.contains(AP_PROPERTIES_KEY_PASSWORD)) {
|
if (map.contains(AP_PROPERTIES_KEY_PASSWORD)) {
|
||||||
std::string password_decrypted;
|
std::string password_decrypted;
|
||||||
if (decrypt(map[AP_PROPERTIES_KEY_PASSWORD], password_decrypted)) {
|
const auto& encrypted_password = map[AP_PROPERTIES_KEY_PASSWORD];
|
||||||
|
if (encrypted_password.empty()) {
|
||||||
|
apSettings.password = "";
|
||||||
|
} else if (decrypt(encrypted_password, password_decrypted)) {
|
||||||
apSettings.password = password_decrypted;
|
apSettings.password = password_decrypted;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -148,7 +151,7 @@ bool load(const std::string& ssid, WifiApSettings& apSettings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (map.contains(AP_PROPERTIES_KEY_CHANNEL)) {
|
if (map.contains(AP_PROPERTIES_KEY_CHANNEL)) {
|
||||||
apSettings.channel = std::stoi(map[AP_PROPERTIES_KEY_CHANNEL].c_str());
|
apSettings.channel = std::stoi(map[AP_PROPERTIES_KEY_CHANNEL]);
|
||||||
} else {
|
} else {
|
||||||
apSettings.channel = 0;
|
apSettings.channel = 0;
|
||||||
}
|
}
|
||||||
@ -167,8 +170,12 @@ bool save(const WifiApSettings& apSettings) {
|
|||||||
std::map<std::string, std::string> map;
|
std::map<std::string, std::string> map;
|
||||||
|
|
||||||
std::string password_encrypted;
|
std::string password_encrypted;
|
||||||
if (!encrypt(apSettings.password, password_encrypted)) {
|
if (!apSettings.password.empty()) {
|
||||||
return false;
|
if (!encrypt(apSettings.password, password_encrypted)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
password_encrypted = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
map[AP_PROPERTIES_KEY_PASSWORD] = password_encrypted;
|
map[AP_PROPERTIES_KEY_PASSWORD] = password_encrypted;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user