I am writing a code to implement a user login system, in which the user will enter his details like name and pass which will be stored in a text file. When he will try to login it will ask for the username and password and matches with the one stored in the text file created earlier.
Prob is it is not able to search in text file correctly
user=str(input('Do u have registration(Y/N): \n '))
if user =='Y':
print('Please login now:')
boom=str(input("Enter your name: "))
pass_inp=str(input('Enter your password: \n'))
with open('user_database.txt','r') as f:
if pass_inp in f.readlines() and boom in f.readlines():
print('Welcome User')
else:
print('Invalid Login ID')
elif user == 'N':
print('Please register now,fill the following details:')
name=str(input("Register your name: \n"))
password =str(input('Create your password:\n'))
with open("user_database.txt",'a') as f:
f.write(name+'\n')
f.write(password+'\n')
print('Account successfully created')`````````