-2

So i am currently creating a quiz program which requires a really basic authentication. This is the psuedocode that i have.

Start  
Open UserCredentials.txt (This is where the user ID is stored)  
Get UserID  
If UserID is in UserCredetials.txt( This is the part that i could not figure out how to do)  
..Passtries = 0  
..While passtries != 1  
....Get password  
....If password is UserCredentials.txt( The other part which i couldnt do.)  
......Passtries = 1 (Correct password, it will exit the loop)   
....else  
......Passtries = 0 (wrong password, it will continue looping)  
....WhileEnd

So the problem here is that i could not figure out how to check the UserCredentials.txt file based on what the user has inputted and write the code for it in python. (Python 2.7.11)

Note that in the UserCredentials.txt, the userID and password are stored side by side [Izzaz abc123]

Also i am still kind off new to python, so go easy on me :)
Any help is appreciated.

Stop harming Monica
  • 12,141
  • 1
  • 36
  • 56
Izzaz
  • 1
  • 1
  • Take a look at [`raw_input()`](https://docs.python.org/2/library/functions.html#raw_input) – JazZ Sep 20 '16 at 10:53

1 Answers1

0

.you should start to use dict for data container and xml or json for the formatting

UserCredentials.xml

members_dict:
    User(Name = "izzaz", Passwort: "abc123")
    User(Name = "isssz", Passwort: "asassa")

.start
.open UserCredentials.xml/json
.get members_users
.if user_id_input in members_users continue 
.if user_passwort_input == members[user_id_input][passwort]:

its only a guide how it can work, more information about OrderedDict, Xml Parsing, create simple Xml file

Community
  • 1
  • 1
Ari Gold
  • 1,528
  • 11
  • 18