30 lines
722 B
C++
30 lines
722 B
C++
#ifndef COURSE_DESIGN_USERAUTH_H_
|
|
#define COURSE_DESIGN_USERAUTH_H_
|
|
|
|
#include "sqlite3.h"
|
|
#include "tools.h"
|
|
|
|
using namespace std;
|
|
|
|
struct UserStruct {
|
|
int id;
|
|
string username;
|
|
string userpassword;
|
|
string created_time;
|
|
};
|
|
|
|
void init_user_data(sqlite3 *db);
|
|
|
|
bool is_user_table_empty(sqlite3 *db);
|
|
|
|
void register_user(sqlite3 *db, const string &username,
|
|
const string &userpassword);
|
|
bool login_user(sqlite3 *db, const std::string &username,
|
|
const std::string &password);
|
|
bool update_user(sqlite3 *db, int id, const string &new_username,
|
|
const string &new_password);
|
|
vector<UserStruct> get_user_inputs(sqlite3 *db);
|
|
|
|
bool delete_user(sqlite3 *db, int id);
|
|
|
|
#endif |