I am having trouble getting these checks to work. it is for a password change program using tkinter. The aim is to make sure the password has both capital and lowercase letters, and is more than 8 characters long. the code always outputs false, even when the password should pass all the checks.
def check_password():
global oldpassword_entry
oldpasswordcheck= oldpassword_entry.get()
global newpassword_entry
newpasswordcheck= newpassword_entry.get()
global newpasswordconfirmed_entry
newpasswordconfirmedcheck= newpasswordconfirmed_entry.get()
if oldpasswordcheck == oldpassword:
if (any(x.isupper() for x in newpasswordcheck) and any(x.islower() for x in newpasswordcheck) and any(x.isdigit() for x in newpasswordcheck) and len(s) >= 8):
if newpasswordcheck == newpasswordconfirmedcheck:
passwordtrue = 'true'
print(passwordtrue)
showoldpasswordchange_label.configure(text=newpasswordconfirmedcheck)
else:
passwordtrue = 'false'
print(passwordtrue)
else:
passwordtrue = 'false'
print(passwordtrue)
else:
passwordtrue = 'false'
print(passwordtrue)
okaybutton_button = ttk.Button(root, text= "Okay", width= 20, command= check_password)
the variables at the start of the function come from the entries here:
showoldpassword_label = tk.Label(root, text = 'Current Password: ', font=('calibre',10, 'bold'))
showoldpasswordchange_label = tk.Label(root, text = 'PasswordExample', font=('calibre',10, 'bold'))
oldpassword_label = tk.Label(root, text = 'Old Password: ', font=('calibre',10, 'bold'))
oldpassword_entry = tk.Entry(root, font=('calibre',10,'normal'), show = '*')
newpassword_label = tk.Label(root, text = 'New Password: ', font=('calibre',10, 'bold'))
newpassword_entry = tk.Entry(root, font=('calibre',10,'normal'), show = '*')
newpasswordconfirmed_label = tk.Label(root, text = 'Confirm Password: ', font=('calibre',10, 'bold'))
newpasswordconfirmed_entry = tk.Entry(root, font=('calibre',10,'normal'), show = '*')
when the code is run it makes this box:
