Use User model instead of raw sql for login
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include "db/SQLHelper.h"
|
#include "db/SQLHelper.h"
|
||||||
#include "InputObject.h"
|
#include "InputObject.h"
|
||||||
|
#include "models/User.h"
|
||||||
|
|
||||||
#define splitFlag QString("-")
|
#define splitFlag QString("-")
|
||||||
|
|
||||||
@@ -145,10 +146,13 @@ void LoginWindow::doLogin()
|
|||||||
strPassWord = "12345678";
|
strPassWord = "12345678";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString encryptPwd = getEncryptedPassword(strPassWord);
|
QString encryptPwd = getEncryptedPassword(strPassWord);
|
||||||
QString sql = QString("select UserCode from Account where UserCode='%1' and Password='%2'")
|
QString sql = QString("select UserCode from Account where UserCode='%1' and Password='%2'")
|
||||||
.arg(strUserCode).arg(encryptPwd);
|
.arg(strUserCode).arg(encryptPwd);
|
||||||
if (SQLHelper::QueryCount(sql) > 0)
|
if(User::QueryUser(strUserCode,encryptPwd))
|
||||||
|
// if (SQLHelper::QueryCount(sql) > 0)
|
||||||
{
|
{
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user