So i'm making a password keeper for fun(not intended to be used for anything other than teaching myself), and I want the user to be able to edit their username and password.
The way I had it set up is it asks you for a username and password, it checks your responses against a couple of very specific values(line 74), if the statement was true, it would allow access and if it isn't, it would deny access.
I then tried to set the statement "if(yourUser == yourNewUser and yourPass == yourNewPass):" it gives me a variable undefined error when I try to log in which I sort of expected.
So I tried defining the variables early on, setting each of them as 0 so if the password is unchanged, it would go to the regular bit, and if they have been changed or if they don't equal 0, it would go to a different function that does the same thing and it sort of worked, but then denied me access...
I don't know what to try next. If you need any clarification on anything that I said, just ask and I'll try to help.
Here's my code:
#The goodbye or end statement
def goodbye():
print('Good Bye! :{D')
#The main password request statement
def request():
reqPass = input('Which password would you like?[Google, Twitter, Reddit, Computer]')
#still need to figure out dictionary manipulation so this is a temporary sytem.
if(reqPass == 'Google' or reqPass == 'google'):
print('________________')
print('Pass: GOOGLEPASSHERE')
print('________________')
reqSecPass = input('Request another password?[y/n]')
if(reqSecPass == 'y' or reqSecPass == 'Y'):
request()
else:
goodbye()
elif(reqPass == 'twitter' or reqPass == 'Twitter'):
print('_________________')
print('User: TWITTERUSERHERE')
print('Pass: TWITTERPASSHERE')
print('________________')
reqSecPass = input('Request another password?[y/n]')
if(reqSecPass == 'y' or reqSecPass == 'Y'):
request()
else:
goodbye()
elif(reqPass == 'computer' or reqPass == 'Computer'):
print('________________')
print('Pass: COMPUTERPASSHERE')
print('________________')
reqSecPass = input('Request another password?[y/n]')
if(reqSecPass == 'y' or reqSecPass == 'Y'):
request()
else:
goodbye()
elif(reqPass == 'reddit' or reqPass == 'Reddit'):
print('_________________________')
print('User: REDDITUSERHERE')
print('Pass: REDDITPASSHERE')
print('________________')
reqSecPass = input('Request another password?[y/n]')
if(reqSecPass == 'y' or reqSecPass == 'Y'):
request()
else:
goodbye()
#This is the start of the changed password function
def changedpass():
if(yourUser == yourNewUser and yourPass == yourNewPass):
dirCheck = input('Account settings?[y,n]')
if(dirCheck == 'y' or dirCheck == 'Y'):
#This is the start of the password/username thing
print('this function is not working yet!')
actSetCheck = input('Change username or password?')
if(actSetCheck == 'user' or actSetCheck == 'User' or actSetCheck == 'Username' or actSetCheck == 'username'):
yourNewUser = input('What would you like your new username to be?')
elif(actSetCheck == 'pass' or actSetCheck == 'Pass' or actSetCheck == 'password' or actSetCheck == 'Password'):
yourNewPass = input('What would you like your new password to be?')
elif(dirCheck == 'n' or dirCheck == 'N'):
request()
#setting the variables early on
yourNewUser == 0
yourNewPass == 0
#This is the "title screen"
print('_____This is a password keeper_____')
#checking if the user has an account
actCheck = input('Do you already have an account?')
if(actCheck == 'Yes' or actCheck == 'yes'):
#Checking to see if the yourNewUser or yourNewPass variable has been changed
if(yourNewUser != '0' or yourNewPass != '0'):
changedpass()
#asking for user's name and password
else:
yourUser = input('___What is your Username?___')
yourPass = input('___What is your Password?___')
if(yourUser == 'ari' and yourPass == 'rycbar1234'):
dirCheck = input('Account settings?[y,n]')
if(dirCheck == 'y' or dirCheck == 'Y'):
#This is the start of the change password/username thing
print('this function is not working yet!')
actSetCheck = input('Change username or password?')
if(actSetCheck == 'user' or actSetCheck == 'User' or actSetCheck == 'Username' or actSetCheck == 'username'):
yourNewUser = input('What would you like your new username to be?')
elif(actSetCheck == 'pass' or actSetCheck == 'Pass' or actSetCheck == 'password' or actSetCheck == 'Password'):
yourNewPass = input('What would you like your new password to be?')
elif(dirCheck == 'n' or dirCheck == 'N'):
request()
#incorrect password thing
else:
print('Incorrect Username or password')