diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-11-14 14:34:53 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-11-14 14:34:53 +0800 |
commit | 91bffad1e8afef36eedf51b50a80a7edf6400f7d (patch) | |
tree | 755d4713a99cb6b789bc797965032d9d21cd15f1 | |
parent | b5a15cf47b9c8d6edac5ebb0b413569dc57c95ee (diff) |
Copy the credentials when logging in (POST)
because otherwise they would get lost before posted.
-rw-r--r-- | admin.cxx | 15 | ||||
-rw-r--r-- | member.cxx | 15 |
2 files changed, 28 insertions, 2 deletions
@@ -1,11 +1,24 @@ +#include <icclient.h> #include <icclient/admin.h> #include "qicclient/admin.hxx" namespace QICClient { + static char *unCopy, *pwCopy; + void Admin::logIn(QString const& username, QString const& password) { - icclient_admin_login(username.toLatin1().constData(), password.toLatin1().constData(), nullptr, nullptr); + auto unData = username.toLatin1().constData(); + unCopy = (char*)malloc(strlen(unData) + 1); + strcpy(unCopy, unData); + auto pwData = password.toLatin1().constData(); + pwCopy = (char*)malloc(strlen(pwData) + 1); + strcpy(pwCopy, pwData); + icclient_admin_login(unCopy, pwCopy, [](icclient_response* response) { + free(unCopy); + free(pwCopy); + icclient_free_response(response); + }, nullptr); } void Admin::setUserName(QString const& userName) @@ -1,11 +1,24 @@ +#include <icclient.h> #include <icclient/member.h> #include "qicclient/member.hxx" namespace QICClient { + static char *unCopy, *pwCopy; + void Member::logIn(QString const& username, QString const& password) { - icclient_member_login(username.toLatin1().constData(), password.toLatin1().constData(), nullptr, nullptr); + auto unData = username.toLatin1().constData(); + unCopy = (char*)malloc(strlen(unData) + 1); + strcpy(unCopy, unData); + auto pwData = password.toLatin1().constData(); + pwCopy = (char*)malloc(strlen(pwData) + 1); + strcpy(pwCopy, pwData); + icclient_member_login(unCopy, pwCopy, [](icclient_response* response) { + free(unCopy); + free(pwCopy); + icclient_free_response(response); + }, nullptr); } void Member::setUserName(QString const& userName) |