summaryrefslogtreecommitdiff
path: root/src/account-server
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2023-05-02 17:20:14 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2023-05-05 16:03:23 +0000
commitad07c93e31ec9cf6ecc508bf8df79ab62c24823e (patch)
treee68751a2e5f38527dac6fab4d50a9992cb4737f5 /src/account-server
parent409b31423533ac3e648f882e4d2380dcf4fcc3ec (diff)
downloadmanaserv-ad07c93e31ec9cf6ecc508bf8df79ab62c24823e.tar.gz
manaserv-ad07c93e31ec9cf6ecc508bf8df79ab62c24823e.tar.bz2
manaserv-ad07c93e31ec9cf6ecc508bf8df79ab62c24823e.tar.xz
manaserv-ad07c93e31ec9cf6ecc508bf8df79ab62c24823e.zip
Use std::make_unique
Diffstat (limited to 'src/account-server')
-rw-r--r--src/account-server/accounthandler.cpp13
-rw-r--r--src/account-server/storage.cpp2
2 files changed, 5 insertions, 10 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index b13b4580..a59e1aa1 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -597,18 +597,13 @@ void AccountHandler::handleRegisterMessage(AccountClient &client,
}
else
{
- // We hash email server-side for additional privacy we ask for it again
+ // We hash email server-side for additional privacy. We ask for it again
// when we need it and verify it through comparing it with the hash.
- std::unique_ptr<Account> acc = createAccount(username,
- sha256(password),
- sha256(email));
+ client.setAccount(createAccount(username, sha256(password), sha256(email)));
+ client.status = CLIENT_CONNECTED;
reply.writeInt8(ERRMSG_OK);
addServerInfo(reply);
-
- // Associate account with connection
- client.setAccount(std::move(acc));
- client.status = CLIENT_CONNECTED;
}
client.send(reply);
@@ -1017,7 +1012,7 @@ std::unique_ptr<Account> AccountHandler::createAccount(const std::string &userna
const std::string &password,
const std::string &email)
{
- std::unique_ptr<Account> acc { new Account };
+ auto acc = std::make_unique<Account>();
acc->setName(username);
acc->setPassword(password);
acc->setEmail(email);
diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp
index 919238b0..34a49cfc 100644
--- a/src/account-server/storage.cpp
+++ b/src/account-server/storage.cpp
@@ -178,7 +178,7 @@ std::unique_ptr<Account> Storage::getAccountBySQL()
// Create an Account instance
// and initialize it with information about the user.
- std::unique_ptr<Account> account { new Account(id) };
+ auto account = std::make_unique<Account>(id);
account->setName(accountInfo(0, 1));
account->setPassword(accountInfo(0, 2));
account->setEmail(accountInfo(0, 3));