Add user entity

This commit is contained in:
Andrew nuark G 2020-12-15 17:07:03 +07:00
parent 4f1b0346c6
commit 8f71fb50a3
3 changed files with 54 additions and 0 deletions

21
entities/user_entity.cpp Normal file
View file

@ -0,0 +1,21 @@
#include "user_entity.h"
user_entity::user_entity(const QString &login, const QString &password, UserRole role) {
this->_pwd_hash = QCryptographicHash::hash(password.toLocal8Bit(), QCryptographicHash::Sha3_256);
}
unsigned long long user_entity::id() {
return this->_id;
}
const QString user_entity::login() {
return this->_login;
}
UserRole user_entity::role() {
return this->_role;
}
bool user_entity::verify_password(const QString &password) {
return (this->_pwd_hash == QCryptographicHash::hash(password.toLocal8Bit(), QCryptographicHash::Sha3_256));
}