diff options
-rw-r--r-- | admin.cxx | 22 | ||||
-rw-r--r-- | interchange/admin.hxx | 1 | ||||
-rw-r--r-- | interchange/member.hxx | 1 | ||||
-rw-r--r-- | member.cxx | 24 |
4 files changed, 29 insertions, 19 deletions
@@ -4,10 +4,10 @@ namespace QInterchange { - static char *unCopy, *pwCopy, *fpCopy; + static char *unCopy, *pwCopy, *npCopy, *fpCopy; void Admin::logIn(QString const& username, QString const& password, - QString const& failPage) + QString const& nextPage, QString const& failPage) { auto unData = username.toLatin1().constData(); unCopy = (char*)malloc(strlen(unData) + 1); @@ -15,16 +15,20 @@ namespace QInterchange { auto pwData = password.toLatin1().constData(); pwCopy = (char*)malloc(strlen(pwData) + 1); strcpy(pwCopy, pwData); + auto npData = nextPage.toLatin1().constData(); + npCopy = (char*)malloc(strlen(npData) + 1); + strcpy(npCopy, npData); auto fpData = failPage.toLatin1().constData(); fpCopy = (char*)malloc(strlen(fpData) + 1); strcpy(fpCopy, fpData); - interchange_admin_login(unCopy, pwCopy, fpCopy, - [](interchange_response* response) { - free(unCopy); - free(pwCopy); - free(fpCopy); - interchange_free_response(response); - }, nullptr); + interchange_admin_login(unCopy, pwCopy, npCopy, fpCopy, + [](interchange_response* response) { + free(unCopy); + free(pwCopy); + free(npCopy); + free(fpCopy); + interchange_free_response(response); + }, nullptr); } void Admin::setUserName(QString const& userName) diff --git a/interchange/admin.hxx b/interchange/admin.hxx index 2c0d86b..1f00df4 100644 --- a/interchange/admin.hxx +++ b/interchange/admin.hxx @@ -39,6 +39,7 @@ namespace QInterchange { public slots: void logIn(QString const& username, QString const& password, + QString const& nextPage = nullptr, QString const& failPage = nullptr); void newAdmin(QString const& userName, QString const& password, QString const& name, bool super, enum interchange_admin_group group); diff --git a/interchange/member.hxx b/interchange/member.hxx index 57467de..897b086 100644 --- a/interchange/member.hxx +++ b/interchange/member.hxx @@ -84,6 +84,7 @@ namespace QInterchange { QString const& failPage = nullptr); void logIn(QString const& username, QString const& password, + QString const& nextPage = nullptr, QString const& failPage = nullptr); void account(); void setAccount(QString const& firstName, @@ -5,7 +5,7 @@ namespace QInterchange { static Member* member; - static char *unCopy, *pwCopy, *vCopy, *fpCopy; + static char *unCopy, *pwCopy, *vCopy, *npCopy, *fpCopy; static interchange_member* mPtr; Member::Member(QObject* parent) : @@ -62,7 +62,7 @@ namespace QInterchange { } void Member::logIn(QString const& username, QString const& password, - QString const& failPage) + QString const& nextPage, QString const& failPage) { auto unData = username.toLatin1().constData(); unCopy = (char*)malloc(strlen(unData) + 1); @@ -70,17 +70,21 @@ namespace QInterchange { auto pwData = password.toLatin1().constData(); pwCopy = (char*)malloc(strlen(pwData) + 1); strcpy(pwCopy, pwData); + auto npData = nextPage.toLatin1().constData(); + npCopy = (char*)malloc(strlen(npData) + 1); + strcpy(npCopy, npData); auto fpData = failPage.toLatin1().constData(); fpCopy = (char*)malloc(strlen(fpData) + 1); strcpy(fpCopy, fpData); - interchange_member_login(unCopy, pwCopy, fpCopy, - [](interchange_response* response) { - free(unCopy); - free(pwCopy); - free(fpCopy); - member->emitLogin(QString{response->data}); - interchange_free_response(response); - }, nullptr); + interchange_member_login(unCopy, pwCopy, npCopy, fpCopy, + [](interchange_response* response) { + free(unCopy); + free(pwCopy); + free(npCopy); + free(fpCopy); + member->emitLogin(QString{response->data}); + interchange_free_response(response); + }, nullptr); } void Member::setAccount(QString const& firstName, |