Skip to content

Commit

Permalink
Don't store ssid when encryption failed
Browse files Browse the repository at this point in the history
  • Loading branch information
KenVanHoeylandt committed Jan 17, 2024
1 parent d8b2291 commit 1ed7489
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions components/tactility/src/services/wifi/wifi_credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,11 @@ bool tt_wifi_credentials_set(const char* ssid, char password[TT_WIFI_CREDENTIALS
TT_LOG_E(TAG, "Failed to encrypt credentials for \"%s\": %d", ssid, encrypt_result);
}

result = nvs_set_blob(handle, ssid, password_encrypted, TT_WIFI_CREDENTIALS_PASSWORD_LIMIT);
if (result != ESP_OK) {
TT_LOG_E(TAG, "Failed to get credentials for \"%s\": %s", ssid, esp_err_to_name(result));
if (result == ESP_OK) {
result = nvs_set_blob(handle, ssid, password_encrypted, TT_WIFI_CREDENTIALS_PASSWORD_LIMIT);
if (result != ESP_OK) {
TT_LOG_E(TAG, "Failed to get credentials for \"%s\": %s", ssid, esp_err_to_name(result));
}
}

tt_wifi_credentials_nvs_close(handle);
Expand Down

0 comments on commit 1ed7489

Please sign in to comment.