Guest User

Untitled

a guest
Apr 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. def login():
  2. username = str(input("Please enter your username to login: "))
  3. password = str(input("Please enter your password to login: "))
  4. joint =(username+password)
  5. message = hashPW(joint)
  6. s.send(message.encode())
  7. ls = s.recv(1024)
  8. print(ls)
  9. while ls != "Login successfull":
  10. login()
  11. else:
  12. after_choice()
  13.  
  14. def recive():
  15. global password
  16. password = c.recv(1024).decode()#reciving the password
  17. print("Password from client: ", password)
  18. PWcheck()
  19.  
  20. def PWcheck():
  21. f= open("passwords.txt")
  22. f1=f.readlines()
  23. if password in f1:
  24. print("Login successfull")
  25. ls =("Login successfull")
  26. c.send(ls.encode())
  27. wait() #just the next class
  28. else:
  29. print("Username or password incorrect")
  30. ls =("Username or password incorrect")
  31. c.send(ls.encode())
  32. recive()
Add Comment
Please, Sign In to add comment