-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (45 loc) · 1.61 KB
/
main.py
File metadata and controls
55 lines (45 loc) · 1.61 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
import sys
from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox, QTableWidgetItem, QFileDialog, QMainWindow
from PyQt5 import QtGui, QtCore
from PyQt5.QtGui import QCursor
from views.login_ui import Ui_Form
from data.db_sesion import Sesion
import hashlib
class Login(QDialog):
def __init__(self):
super().__init__()
self.usuario = ''
self.passwd = ''
self.ui = Ui_Form()
self.ui.setupUi(self)
self.sesion = Sesion()
self.ui.pushButton.clicked.connect(self.ingreso)
self.ui.lineEdit.setFocus()
#self.ui.lineEdit.setCursor()
self.ui.label.setCursor(QCursor(QtCore.Qt.PointingHandCursor))
self.ui.label_2.setCursor(QCursor(QtCore.Qt.PointingHandCursor))
def cifradoPasswd(self, passwd):
clave_cifrada = hashlib.sha512(passwd.encode())
return clave_cifrada.hexdigest()
def verificarDatos(self, usuario, passwd):
clavecifrada = self.cifradoPasswd(passwd)
#print(clavecifrada)
self.valor = self.sesion.consulta(usuario, clavecifrada)
print(self.valor)
if self.valor is not None:
return True
else:
return self.valor
def ingreso(self):
self.usuario = self.ui.lineEdit.text()
self.passwd = self.ui.lineEdit_2.text()
entrar= self.verificarDatos(self.usuario, self.passwd)
if entrar == True:
print('Bienvenido...')
else:
print('Datos Erroneos')
if __name__== '__main__':
app = QApplication(sys.argv)
ventana = Login()
ventana.show()
sys.exit(app.exec_())