-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
68 lines (52 loc) · 2.08 KB
/
main.py
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
import json
import sys
from settings import * # You can customize on 'settings.py' file
from PyQt5.QtWidgets import (QApplication, QWidget, QPushButton, QLabel, QLineEdit, QGridLayout, QMessageBox)
from PyQt5 import QtGui
#Json Database
f = open(database, )
data = json.load(f)
f = open(blacklst, )
blacklist = json.load(f)
class LoginWindow(QWidget):
def __init__(panel):
super().__init__()
panel.setWindowTitle(mainbaslik)
panel.setWindowIcon(QtGui.QIcon('Extra/ico.ico'))
panel.resize(500, 120)
label_name = QLabel('<font size="4"> %s </font>' % mainisim )
panel.lineEdit_username = QLineEdit()
panel.lineEdit_username.setPlaceholderText(isimplaceholder)
layout = QGridLayout()
layout.addWidget(label_name, 0, 0)
layout.addWidget(panel.lineEdit_username, 0, 1)
label_password = QLabel('<font size="4"> %s </font>' % mainsifre)
panel.lineEdit_password = QLineEdit()
panel.lineEdit_password.setPlaceholderText(sifreplaceholder)
layout.addWidget(label_password, 1, 0)
layout.addWidget(panel.lineEdit_password, 1, 1)
button_login = QPushButton(girisButon)
button_login.clicked.connect(panel.check_password)
layout.addWidget(button_login, 2, 0, 1, 2)
layout.setRowMinimumHeight(2, 75)
panel.setLayout(layout)
def check_password(panel):
msg = QMessageBox()
if panel.lineEdit_username.text() in blacklist:
msg.setWindowTitle(blacklistB)
msg.setText(blacklistNormal + '\n' + blacklistReason + blacklist[panel.lineEdit_username.text()])
msg.exec_()
else:
if panel.lineEdit_username.text() in data and panel.lineEdit_password.text() == data[panel.lineEdit_username.text()]:
msg.setWindowTitle(basariliB)
msg.setText(basariliNormal + '\n' + basariliIsim + panel.lineEdit_username.text() + '\n' + basariliSifre + panel.lineEdit_password.text())
msg.exec_()
else:
msg.setWindowTitle(hataliB)
msg.setText(hataliNormal + hataliErrorMsg)
msg.exec_()
if __name__ == '__main__':
uyglm = QApplication(sys.argv)
realapp = LoginWindow()
realapp.show()
sys.exit(uyglm.exec_())