diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-01-12 15:13:44 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-01-12 15:13:44 +0800 |
commit | 1e3acb613c9bfcc87c88aa6bfde2b21330dd7dd3 (patch) | |
tree | c58ef6d51cf4ff3a4bca9b24f7b7e94b1eb52b3a | |
parent | add4c1a7708fd2cb896f27559842a76f30930a0d (diff) |
New account wrapper
-rw-r--r-- | interchange/member.hxx | 3 | ||||
-rw-r--r-- | member.cxx | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/interchange/member.hxx b/interchange/member.hxx index bd569c6..c75c7a3 100644 --- a/interchange/member.hxx +++ b/interchange/member.hxx @@ -99,6 +99,9 @@ namespace QInterchange { void setEmail(QString const& email); public slots: + void newAccount(QString const& username, + QString const& password, + QString const& confirm); void logIn(QString const& username, QString const& password); void account(QString const& firstName, QString const& lastName, QString const& address1, QString const& address2, @@ -4,7 +4,28 @@ namespace QInterchange { - static char *unCopy, *pwCopy; + static char *unCopy, *pwCopy, *cfCopy; + + void Member::newAccount(QString const& username, + QString const& password, QString const& confirm) + { + 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); + auto cfData = confirm.toLatin1().constData(); + cfCopy = (char*)malloc(strlen(cfData) + 1); + strcpy(cfCopy, cfData); + interchange_member_newaccount(unCopy, pwCopy, cfCopy, + [](interchange_response* response) { + free(unCopy); + free(pwCopy); + free(cfCopy); + interchange_free_response(response); + }, nullptr); + } void Member::logIn(QString const& username, QString const& password) { |