generated from Sithas/conan_template
Доработка интерфейса ДАО
This commit is contained in:
+16
-5
@@ -1,28 +1,39 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "User.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace uad
|
||||
{
|
||||
const std::string& User::GetGUID() const noexcept
|
||||
const string& User::GetGUID() const noexcept
|
||||
{
|
||||
return guid_;
|
||||
}
|
||||
|
||||
void User::SetGUID(const std::string& new_guid)
|
||||
void User::SetGUID(const string& new_guid)
|
||||
{
|
||||
guid_ = new_guid;
|
||||
}
|
||||
|
||||
const std::string& User::GetLogin() const noexcept
|
||||
const string& User::GetLogin() const noexcept
|
||||
{
|
||||
return login_;
|
||||
}
|
||||
|
||||
void User::SetLogin(const std::string& login)
|
||||
void User::SetLogin(const string& login)
|
||||
{
|
||||
login_ = login;
|
||||
}
|
||||
|
||||
const std::string& User::GetHashedPassword() const noexcept
|
||||
void User::SetPassword(const string& password)
|
||||
{
|
||||
size_t calculated_hash = hash<string>{}(password);
|
||||
hashed_password_ = ToHex((byte*)&calculated_hash, sizeof(calculated_hash));
|
||||
}
|
||||
|
||||
const string& User::GetHashedPassword() const noexcept
|
||||
{
|
||||
return hashed_password_;
|
||||
}
|
||||
|
||||
+5
-1
@@ -2,13 +2,15 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../helpers/helpers.h"
|
||||
|
||||
namespace uad
|
||||
{
|
||||
class User
|
||||
{
|
||||
std::string guid_;
|
||||
std::string login_;
|
||||
const std::string hashed_password_;
|
||||
std::string hashed_password_;
|
||||
public:
|
||||
[[nodiscard]] const std::string& GetGUID() const noexcept;
|
||||
|
||||
@@ -18,6 +20,8 @@ public:
|
||||
|
||||
void SetLogin(const std::string& login);
|
||||
|
||||
void SetPassword(const std::string& password);
|
||||
|
||||
[[nodiscard]] const std::string& GetHashedPassword() const noexcept;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user