Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- import time
- from Commands import date
- print ("""Welcome to your python main program,
- do you already have an account?""")
- answer_1 = int(input("""(1) Yes
- (2) No
- """))
- while True :
- if answer_1 == int(1):
- passage_1 = False
- print("Welcome back, what's your name?")
- name = str(input())
- user_pass = "f8412zf89451eg498s5q65f4e8"
- rf = open("Main.txt", "r")
- for line in rf:
- line.strip().split("/n")
- if name in line:
- user_pass = line
- rf.close()
- print ("What is your password?")
- pass_guess = str(input())
- pass_input = str(name) + " " + str(pass_guess) + "\n"
- if str(pass_input) == str(user_pass):
- passage_1 = True
- if str(pass_input) != str(user_pass):
- passage_1 = False
- if passage_1 == False:
- print("""Either you
- (1)Spelled something wrong
- (2)Don't have an account yet""")
- answer_2 = int(input())
- if answer_2 == int(1):
- print("What's your name?")
- name = str(input())
- rf = open("Main.txt", "r")
- for line in rf:
- line.strip().split("/n")
- if name in line:
- user_pass = line
- rf.close()
- print ("What is your password?")
- pass_guess = str(input())
- pass_input = str(name) + " " + str(pass_guess) + "\n"
- if str(pass_input) != str(user_pass):
- print("""That's no known user.
- The program will end itself.""")
- time.sleep(5)
- sys.exit()
- if answer_2 == int(2):
- equal = False
- username = input("What's your name? ")
- print("To keep your data safe, we work with passwords")
- while equal == False :
- password_1 = input("What do you chose as password? ")
- password_2 = input("Can you confirm this to be sure? ")
- if str(password_1) != str(password_2) :
- print("It seems like your password and it's confirmation are not the same, please try again.")
- if str(password_1) == str(password_2) :
- equal = True
- af = open("Main.txt", "a")
- text_af = str(username) + " " + str(password_1)
- af.write(text_af)
- af.write("\n")
- af.close()
- print("The program will now end itself, when you restart it, you'll be able to log in")
- time.sleep(5)
- sys.exit()
- if answer_1 == int(2):
- equality = False
- username = str(input("What's your name? "))
- print("To keep your data safe, we work with passwords")
- while equality == False :
- password_1 = str(input("What do you chose as password? "))
- password_2 = str(input("Can you confirm this to be sure? "))
- if password_1 != password_2:
- print("It seems like your password and it's confirmation are not the same, please try again.")
- if password_1 == password_2:
- equality = True
- af = open("Main.txt", "a")
- text_af = str(username) + " " + str(password_1)
- af.write(text_af)
- af.write("\n")
- af.close()
- print("When you restart the program, you'll be able to log in.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement