I'm doing some programming in Flask, and as part of the program I'm doing a basic system of logging in, but that's not where my problem resides. During my programming, the page that is supposed to verify a login absolutely refuses to go past a specific line of code, regardless of what's past that line or what that line is doing. Here's the code:
@app.route('/loginConfirm') def loginConfirm(): try: username = request.args.get('usernameField') password = request.args.get('passwordField') for user in usersList: if(username == user.username): print(user.hashedPassword == sha256(password.encode('utf-8')).hexdigest()) if(user.hashedPassword == sha256(password.encode('utf-8')).hexdigest()): session.pop('uuid') session['uuid'] = user.uuid return redirect('/') return redirect('/login') except: return redirect('/login')
In this example, it will get to the print statement where I print whether or not the password is equivalent to the other (this returns True when its supposed to and is working correctly.). The problem lies in the fact that if I were to add another print statement directly after that, or any other type of statement including the if statement that is already there, then it won't execute, but it also won't throw an error. What confuses me is that the fact that it occurs only on this line makes me think it's something to do with an indentation error or a problem with the fact that its in a try statement, but if either of those are true then I can't find the result. Any help is greatly appreciated.