Skip to content

Commit 6133e81

Browse files
authored
login error handler
1 parent b5b857a commit 6133e81

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

passwdmanager.exe

30.7 KB
Binary file not shown.

passwdmanager.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,20 @@ def enter():
2020
enter.user = input("Enter database username: ")
2121
enter.passwd = getpass.getpass("Enter database password: ")
2222
enter.k = getpass.getpass("Enter master password: ")
23-
func()
23+
test_login()
24+
25+
def test_login():
26+
try:
27+
#connect to database
28+
mydb = mysql.connector.connect(
29+
host='localhost', #or your hostname/ip-address
30+
user=(enter.user),
31+
password=(enter.passwd)
32+
)
33+
func()
34+
except mysql.connector.Error as err:
35+
print("\033[1;31;40m Error username or password.Plese try again\033[1;37;40m\n")
36+
enter()
2437

2538
def func():
2639
if enter.user=='' or enter.passwd=='' or enter.k=='': #detect blank input

0 commit comments

Comments
 (0)