Пример #1
0
 def login(self, username, password):
     logging.basicConfig(filename='app.log',
                         filemode='w',
                         format='%(levelname)s - %(asctime)s - %(message)s',
                         level=logging.INFO)
     logging.info("user is trying to login!")
     with open("username.txt") as file_object:
         for i, line1 in enumerate(file_object):
             if str(line1) == username + "\n":
                 with open("password.txt") as file_object2:
                     for j, line2 in enumerate(file_object2):
                         if j == i / 4:
                             if str(line2) == HASH(password) + "\n":
                                 self.login_status = True
     if self.login_status == True:
         print("Here is your following request:")
         try:
             with open("follow_request_{}.txt".format(
                     username)) as file_object:
                 for i, line1 in enumerate(file_object):
                     print(line1)
         except IOError:
             print("there is no following request")
         self.user_name = username
         self.pass_word = password
Пример #2
0
 def get_Info(self):
     logging.basicConfig(filename='app.log', filemode='w', format='%(levelname)s - %(asctime)s - %(message)s',
                         level=logging.INFO)
     logging.info("getting information from user!")
     self.user_name = input("Enter your desired username: "******"Enter your desired password(It should be at least 8 letters): ")
     self.bio = input("You can add bio to your profile: ")
     self.phone = input("You can add phone number to your profile: ")
     self.email = input("You can add email to your profile: ")
     # here we save personal detail in txt files
     with open("username.txt", "a+") as file_object1:
         # Move read cursor to the start of file.
         file_object1.seek(0)
         # If file is not empty then append '\n'
         data = file_object1.read(100)
         if len(data) > 0:
             file_object1.write("\n")
         # Append text at the end of file
         file_object1.write(self.user_name)
     with open("password.txt", "a+") as file_object:
         file_object.seek(0)
         data = file_object.read(100)
         if len(data) > 0:
             file_object.write("\n")
         password = self.pass_word
         file_object.write(HASH(password))
Пример #3
0
 def login(self, username, password):
     with open("username.txt") as file_object:
         for i,line1 in enumerate(file_object):
             if str(line1) == username + "\n":
                 print("1")
                 with open("password.txt") as file_object2:
                     for j, line2 in enumerate(file_object2):
                         if j == i:
                             print("hi")
                             if str(line2) == HASH(password) + "\n":
                                 print("hiii")
                                 self.login_status = True