Python Tkinter GUI User Login Accepting any Username with Correct Password -


alright must missing silly or obvious here have created method check username , password inside of gui , weird things. can type in username long password correct, accept it. have looked @ other similar questions haven't seen answer accounts issue. see i'm doing wrong here? thanks

    def correct_login(text):         stored_user = user_entry.get()         if stored_user == "admin" or "admin":             stored_pass = pass_entry.get()             if stored_pass == "password":                 user_entry.delete(0, 'end')                 pass_entry.delete(0, 'end')                 pass_win.destroy()             else:                 user_entry.delete(0, 'end')                 pass_entry.delete(0, 'end')                 mb.showwarning("incorrect credentials", "the username or password have entered incorrect.")         else:             user_entry.delete(0, 'end')             pass_entry.delete(0, 'end')             mb.showwarning("incorrect credentials", "the username or password have entered incorrect.")      pass_win.bind('<return>',correct_login)      user_label = tk.label(pass_win, text="username", font=("helvetica", 16))     user_entry = tk.entry(pass_win)     pass_label = tk.label(pass_win, text="password", font=("helvetica", 16))     pass_entry = tk.entry(pass_win, show="*")      user_label.grid(row=1, column=0, sticky="e", padx=20, pady=10)     user_entry.grid(row=1, column=1, sticky="w", padx=20, pady=10)     pass_label.grid(row=2, column=0, sticky="e", padx=20, pady=10)     pass_entry.grid(row=2, column=1, sticky="w", padx=20, pady=10)      user_entry.focus_force()      submit_button = tk.button(pass_win, text="submit", command=correct_login)     submit_button.grid(row=3, column=0, sticky=("n", "s", "e", "w"), padx=20, columnspan=2)     quit_button = tk.button(pass_win, text="quit", command=pass_win.destroy)     quit_button.grid(row=4, column=0, sticky=("n", "s", "e", "w"), padx=20, columnspan=2)      user_entry.delete(0)     user_entry.insert(0, "")      pass_entry.delete(0)     pass_entry.insert(0, "") 

your check needs be:

if stored_user == "admin" or stored_user == "admin": 

more info here.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -