Updated the if-statement for password_required decorator to be more robust.