-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChangePasswordPage.qml
executable file
·143 lines (121 loc) · 4.94 KB
/
ChangePasswordPage.qml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Component {
id: changePasswordPage
Item {
id: changePasswordPageRectangle
//color: "transparent"
//visible: false
ScrollView {
id: changePasswordPageScrollView
anchors {
right: parent.right
top: parent.top
left: parent.left
bottom: changePasswordPageBottomRowLayout.top
}
BusyIndicator {
id: changePasswordPageBusyIndicator
anchors.centerIn: parent
visible: false
running: true
}
ColumnLayout {
spacing: 2
anchors.fill: parent
anchors.margins: 10
Label {
text: "Old password"
}
TextField {
id: changePasswordPageOldPasswordTextField
Layout.fillWidth: true
Layout.alignment: Qt.AlignJustify
focus: true
text: stackView.changePasswordPageOldPasswordText
selectByMouse: true
echoMode: TextInput.Password
}
Label {
text: "New password"
}
TextField {
id: changePasswordPageNewPasswordTextField
Layout.fillWidth: true
Layout.alignment: Qt.AlignJustify
focus: true
text: stackView.changePasswordPageNewPasswordText
selectByMouse: true
echoMode: TextInput.Password
}
Label {
id: changePasswordPageStatusLabel
text: "Status:"
}
Item { Layout.fillHeight: true }
}
}
RowLayout {
id: changePasswordPageBottomRowLayout
anchors {
right: parent.right
bottom: parent.bottom
left: parent.left
}
Button {
id: changePasswordPageBackButton
Layout.fillWidth: true
text: "Back"
onClicked: {
stackView.pop();
}
}
Button {
id: changePasswordPageSaveButton
Layout.fillWidth: true
text: "Save"
onClicked: {
changePasswordPageBusyIndicator.visible = true;
changePasswordPageBackButton.enabled = false;
changePasswordPageSaveButton.enabled = false;
changePasswordPageOldPasswordTextField.enabled = false;
changePasswordPageNewPasswordTextField.enabled = false;
/*
passwordSyncClient.sCommand = "SYNC_"+oSettingsModel.fnGetStringValue("syncPageSyncMethod");
passwordSyncClient.fnCallBack = this.settingsPageSyncButtonCallBack;
passwordSyncClient.fnErrorCallBack = this.settingsPageSyncButtonErrorCallBack;
passwordSyncClient.url = "ws://"+syncPageServerIPTextField.text+":3002";
passwordSyncClient.active = true;
*/
if (changePasswordPageNewPasswordTextField.text.length >= 8) {
if (changePasswordPageOldPasswordTextField.text == oPasswordListModel.fnGetPassword()) {
oPasswordListModel.fnSetPassword(changePasswordPageNewPasswordTextField.text);
changePasswordPageStatusLabel.text = "Status: password changed"
} else {
changePasswordPageStatusLabel.text = "Status: wrong old password"
}
} else {
changePasswordPageStatusLabel.text = "Status: new password can't less than 8 symbols"
}
settingsPageSyncButtonCallBack();
}
function settingsPageSyncButtonErrorCallBack()
{
settingsPageSyncButtonCallBack();
}
function settingsPageSyncButtonCallBack()
{
changePasswordPageBusyIndicator.visible = false;
changePasswordPageBackButton.enabled = true;
changePasswordPageSaveButton.enabled = true;
changePasswordPageOldPasswordTextField.enabled = true;
changePasswordPageNewPasswordTextField.enabled = true;
changePasswordPageOldPasswordTextField.text = '';
changePasswordPageNewPasswordTextField.text = '';
passwordSyncClient.active = false;
}
}
}
}
}