-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Minh Đức Trương
committed
Sep 19, 2020
1 parent
3057b1f
commit 63ae408
Showing
40 changed files
with
2,342 additions
and
85 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>Images/BackGr/bkgr_Login.jpg</file> | ||
<file>Images/BackGr/bkgr_SignUp.jpg</file> | ||
<file>Images/BackGr/budget.jpg</file> | ||
<file>Images/Pictures/User_Avatar_.png</file> | ||
<file>Images/BackGr/bkgr_Login.jpg</file> | ||
<file>Images/Pictures/Arrows-Down.png</file> | ||
<file>Images/Pictures/bachHoa.png</file> | ||
<file>Images/Pictures/DiChuyen.png</file> | ||
<file>Images/Pictures/GiaiTri.png</file> | ||
<file>Images/Pictures/HoaDon.png</file> | ||
<file>Images/Pictures/HocPhi.png</file> | ||
<file>Images/Pictures/Khac.png</file> | ||
<file>Images/Pictures/KinhDoanh.png</file> | ||
<file>Images/Pictures/MuaSam.png</file> | ||
<file>Images/Pictures/QuaTang.png</file> | ||
<file>Images/Pictures/SucKhoe.png</file> | ||
<file>Images/Pictures/GiaDinh.png</file> | ||
<file>Images/Pictures/ID-Card-icon.png</file> | ||
<file>Images/Pictures/savings-icon.png</file> | ||
<file>Images/Pictures/No-icon.png</file> | ||
<file>Images/BackGr/nkgr_p4.jpg</file> | ||
<file>Images/Pictures/user-icon.png</file> | ||
<file>Images/Pictures/reload-icon.png</file> | ||
</qresource> | ||
</RCC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,116 @@ | ||
#include "changepin.h" | ||
#include "ui_changepin.h" | ||
|
||
#include <expensetracker.h> | ||
|
||
#include <QtSql/QSqlDatabase> | ||
#include <QtSql/QSqlQuery> | ||
#include <QMessageBox> | ||
#include <QDebug> | ||
|
||
ChangePin::ChangePin(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::ChangePin) | ||
{ | ||
ui->setupUi(this); | ||
|
||
this->setWindowTitle(QString::fromUtf8("Thay mã pin")); | ||
|
||
//DataBase | ||
QSqlDatabase myDB = QSqlDatabase::addDatabase("QODBC"); | ||
|
||
myDB.setDatabaseName("DRIVER={SQL Server Native Client 11.0};SERVER=DEREKPC;DATABASE=DO_AN_CHI_TIEU;UID=sa;PWD=derek123;WSID=.;Trusted_connection=yes"); | ||
|
||
bool connected = myDB.open(); | ||
|
||
if(!connected) QMessageBox::warning(this,"Chú ý",QString::fromUtf8("Lỗi! Không kết nối được CSDL!!")); | ||
} | ||
|
||
ChangePin::~ChangePin() | ||
{ | ||
delete ui; | ||
} | ||
|
||
QString ChangePin::Encrypt(QString str){ | ||
QString res=""; | ||
|
||
srand(time(NULL)); | ||
|
||
for(int i = 0; i<str.size(); ++i){ | ||
res+= QString::number((str[i].unicode() - 48 ) * 23 + 1998) ; | ||
int asc = 130 + ( rand() % ( 223 - 130 + 1 ) ); | ||
res+=char(asc); | ||
} | ||
return res; | ||
} | ||
|
||
QString ChangePin::Decrypt(QString str){ | ||
int s=0; | ||
QString res=""; | ||
for(int i = 0; i<str.size(); ++i){ | ||
if( str[i].unicode() < 48 || str[i].unicode() > 57 ){ | ||
s = (s - 1998)/23; | ||
res += QString::number(s); | ||
s=0; | ||
continue; | ||
} | ||
|
||
s = s*10 + (str[i].unicode() - 48); | ||
} | ||
return res; | ||
} | ||
|
||
void ChangePin::on_pushButton_XacNhan_clicked() | ||
{ | ||
QString MaPinCu, MaPinMoi, NhapLaiMaPinMoi; | ||
|
||
MaPinCu = ui->lineEdit_MaPinCu->text(); | ||
MaPinMoi = ui->lineEdit_MaPinMoi->text(); | ||
NhapLaiMaPinMoi = ui->lineEdit_NhapLaiMaPinMoi->text(); | ||
|
||
|
||
|
||
for ( int i = 0; i < MaPinMoi.size(); ++i) { | ||
if( MaPinMoi[i] < 48 || MaPinMoi[i] > 57 ){ | ||
QMessageBox::warning(this,"Chú ý",QString::fromUtf8("Mã pin chỉ gồm các chữ số")); | ||
return; | ||
} | ||
} | ||
|
||
if( MaPinMoi != NhapLaiMaPinMoi ) { | ||
QMessageBox::warning(this,"Chú ý",QString::fromUtf8("Nhập lại mã pin sai!!")); | ||
return; | ||
} | ||
|
||
myDB.open(); | ||
QSqlQuery qry; | ||
|
||
QString DecryptMaPin; | ||
|
||
if( qry.exec("select * from NguoiDung Where TenDangNhap = '"+TenDangNhap+"'") ){ | ||
while( qry.next() ){ | ||
DecryptMaPin = Decrypt(qry.value("MaPin").toString()); | ||
if( MaPinCu != DecryptMaPin ){ | ||
QMessageBox::warning(this,"Chú ý",QString::fromUtf8("Mã pin cũ không chính xác!!")); | ||
return; | ||
} | ||
} | ||
|
||
} | ||
|
||
QString EncryptMaPin = Encrypt(MaPinMoi); | ||
|
||
if( qry.exec("update NguoiDung set MaPin = '"+EncryptMaPin+"' where TenDangNhap = '"+TenDangNhap+"'") ){ | ||
QMessageBox::information(this,"Thông báo",QString::fromUtf8("Đã thay đổi mã pin thành công!!")); | ||
this->hide(); | ||
} | ||
else QMessageBox::warning(this,"Lỗi",QString::fromUtf8("Lỗi không thể thay đổi mã pin!!")); | ||
this->hide(); | ||
|
||
} | ||
|
||
void ChangePin::on_pushButton_Huy_clicked() | ||
{ | ||
QMessageBox::warning(this,"Chú ý",QString::fromUtf8("Bạn có chắc muốn huỷ!!")); | ||
this->close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.