Storia
 
Loading...
Searching...
No Matches
user.h
Go to the documentation of this file.
1#pragma once
2
3
4#include <nlohmann/json.hpp>
5#include <string>
6class User
7{
8public:
9 User();
10
11 std::string getEmail() { return this->email;}
12 std::string getPassword() { return this->password;}
13 std::string getUserName() { return this->userName;}
14 std::size_t getId() { return this->id;}
15 bool getIsAdmin() { return this->isAdmin;}
16
17 void setAdmin() { this->isAdmin = true;}
18 void setUserName(std::string name) { this->userName = name;}
19
20 bool checkEmail(const std::string& email, const std::string& fileName);
21 bool checkPassword(const std::string& password);
22 bool isUserEmpty() { return this->email.size() == 0; }
23
24 nlohmann::json saveAsJson();
25 bool loadFromFile(const std::string& fileName, const std::string& emailToFind);
26
27 void displayUser();
28 void eraseUser();
29private:
30
31 size_t id;
32 bool isAdmin;
33 std::string email;
34 std::string password;
35 std::string userName;
36};
bool checkPassword(const std::string &password)
Definition users.cpp:45
void setAdmin()
Definition user.h:17
User()
Definition users.cpp:4
nlohmann::json saveAsJson()
Definition users.cpp:71
bool checkEmail(const std::string &email, const std::string &fileName)
Definition users.cpp:9
void setUserName(std::string name)
Definition user.h:18
std::string getUserName()
Definition user.h:13
std::string getEmail()
Definition user.h:11
void displayUser()
Definition users.cpp:114
std::string getPassword()
Definition user.h:12
bool loadFromFile(const std::string &fileName, const std::string &emailToFind)
Definition users.cpp:81
bool getIsAdmin()
Definition user.h:15
bool isUserEmpty()
Definition user.h:22
std::size_t getId()
Definition user.h:14
void eraseUser()
Definition users.cpp:124