0
I am creating a study application for a simple login screen, on the same black screen. I created 2 files, one where I create the database query and the other with the application code itself. It has two tasks, login and registration. The log is working perfectly. However I could not come up with the logic for authentication. I made a select, had it printed to test and it’s returning right.
query sql
def select_db(self, username, password):
self.cursor.execute('SELECT * FROM tbl_login WHERE username = ? AND password = ?',
(username, password))
application code
def login():
db = Database('login.db')
print('\n ** ENTER WITH YOUR USERNAME **')
username = input(' Username: ')
password = getpass.getpass(' Password: ')
auth = db.select_db(username, password)
if username and password in auth:
print('\n Welcome to system!')
else:
print('\n Login error! Try again!')
login()
It was in the can huh! I feel bad for my stupidity, rs. Thanks, solved!
– Tguitarful