Timesheets-Server
Timesheets server
Načítám...
Vyhledávám...
Nebylo nic nalezeno
authenticateduser.cpp
Zobrazit dokumentaci tohoto souboru.
1
6#include "authenticateduser.h"
7#include "pdebug.h"
8#include "db.h"
9
10AuthenticatedUser::AuthenticatedUser(QObject *parent) : QObject(parent) {
11 m_authenticated = false;
12 m_user = 0;
13}
14
15
16bool AuthenticatedUser::authenticate(const QString& login, const QString& password) {
17 m_login = login;
18 m_name.clear();
19 m_lang = "en";
20 m_authenticated = false;
21 Db::Database *db = Db::Database::create(this);
22 QList<Dbt::Users> list = db->authenticate(login, password);
23 if (list.isEmpty()) {
24 return false;
25 }
26 const Dbt::Users& item = list[0];
27 m_user = item.user;
28 m_name = item.name;
29 m_lang = item.lang;
30 m_admin = item.admin;
31 m_authenticated = true;
32 return true;
33}
34
35