-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforget_password.cpp
More file actions
60 lines (55 loc) · 1.42 KB
/
forget_password.cpp
File metadata and controls
60 lines (55 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "forget_password.h"
#include "ui_forget_password.h"
#include "Global.h"
#include "QMessageBox"
forget_password::forget_password(QWidget *parent) :
QDialog(parent),
ui(new Ui::forget_password)
{
ui->setupUi(this);
this->setFixedSize(954,581);
setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
}
forget_password::~forget_password()
{
delete ui;
}
void forget_password::on_buttonBox_accepted()
{
QString username, password, password2;
username=ui->lineEdit_username->text();
password=ui->lineEdit_new_password->text();
password2=ui->lineEdit_repeat_password->text();
Global glob;
if (password != password2)
{
ui->lineEdit_repeat_password->setStyleSheet("background: rgb(255,0,0);");
}
else
{
bool username_valid=0;
for (int i = 0; i < glob.vec_person.size(); i++)
{
if (username == glob.vec_person[i].get_user_name())
{
username_valid=1;
glob.vec_person[i].set_password(password);
glob.save();
}
}
if (username_valid==0)
{
QMessageBox* qm=new QMessageBox(this);
qm->setText("username doesn't exits");
qm->exec();
}
}
}
int forget_password::getIndex_vector() const
{
return index_vector;
}
void forget_password::setIndex_vector(int newIndex_vector)
{
index_vector = newIndex_vector;
}