somfytahoma: Fix credential encoding

This fixes the login with passwords that contain HTML special chars.
master
Christian Fetzer 2021-04-04 16:28:24 +02:00
parent ff1355e1a5
commit c7a94f4a02
1 changed files with 4 additions and 1 deletions

View File

@ -83,7 +83,10 @@ SomfyTahomaRequest *createSomfyTahomaGetRequest(NetworkAccessManager *networkMan
SomfyTahomaRequest *createSomfyTahomaLoginRequest(NetworkAccessManager *networkManager, const QString &username, const QString &password, QObject *parent)
{
return createSomfyTahomaPostRequest(networkManager, "/login", "application/x-www-form-urlencoded", QString("userId=" + username + "&userPassword=" + password).toUtf8(), parent);
QUrlQuery postData;
postData.addQueryItem("userId", username);
postData.addQueryItem("userPassword", password);
return createSomfyTahomaPostRequest(networkManager, "/login", "application/x-www-form-urlencoded", postData.toString(QUrl::FullyEncoded).toUtf8(), parent);
}
SomfyTahomaRequest *createSomfyTahomaEventFetchRequest(NetworkAccessManager *networkManager, const QString &eventListenerId, QObject *parent)