def change(self):
input = open('data.txt', 'r')
log = input.read()
input.close()
connection = pymysql.connect(host='127.0.0.1',
user='root',
password='adminadmin',
db='mydb',
charset='utf8mb4', )
curs = connection.cursor()
curs.execute("SELECT password FROM usr WHERE username = %s", log)
passw = curs.fetchall()
oldpass = (self.lineEdit_2.text(),)
if oldpass[0] == passw[0][0]:
newpass = (self.lineEdit_3.text(),)
curs.execute("""UPDATE usr
set password = %s WHERE username = %s""", (newpass[0],log))
connection.commit()
self.label_10.setStyleSheet('color: rgb(43, 244, 32);')
self.label_10.setText("saved!")
else:
self.label_10.setStyleSheet('color: rgb(227, 110, 112);')
self.label_10.setText("invalid pass :(")
def savelog(self):
global logg
logg = (self.lineEdit.text(),)
return logg