Advertisement
Guest User

while added

a guest
Sep 29th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. import os
  2. import sys
  3. import time
  4. from Commands import date
  5.  
  6.  
  7. print ("""Welcome to your python main program,
  8. do you already have an account?""")
  9. answer_1 = int(input("""(1) Yes
  10. (2) No
  11. """))
  12.  
  13. while True :
  14. if answer_1 == int(1):
  15. passage_1 = False
  16. print("Welcome back, what's your name?")
  17. name = str(input())
  18. user_pass = "f8412zf89451eg498s5q65f4e8"
  19. rf = open("Main.txt", "r")
  20. for line in rf:
  21. line.strip().split("/n")
  22. if name in line:
  23. user_pass = line
  24. rf.close()
  25.  
  26. print ("What is your password?")
  27. pass_guess = str(input())
  28. pass_input = str(name) + " " + str(pass_guess) + "\n"
  29. if str(pass_input) == str(user_pass):
  30. passage_1 = True
  31. if str(pass_input) != str(user_pass):
  32. passage_1 = False
  33.  
  34. if passage_1 == False:
  35. print("""Either you
  36. (1)Spelled something wrong
  37. (2)Don't have an account yet""")
  38. answer_2 = int(input())
  39. if answer_2 == int(1):
  40. print("What's your name?")
  41. name = str(input())
  42. rf = open("Main.txt", "r")
  43. for line in rf:
  44. line.strip().split("/n")
  45. if name in line:
  46. user_pass = line
  47. rf.close()
  48. print ("What is your password?")
  49. pass_guess = str(input())
  50. pass_input = str(name) + " " + str(pass_guess) + "\n"
  51. if str(pass_input) != str(user_pass):
  52. print("""That's no known user.
  53. The program will end itself.""")
  54. time.sleep(5)
  55. sys.exit()
  56. if answer_2 == int(2):
  57. equal = False
  58. username = input("What's your name? ")
  59. print("To keep your data safe, we work with passwords")
  60. while equal == False :
  61. password_1 = input("What do you chose as password? ")
  62. password_2 = input("Can you confirm this to be sure? ")
  63. if str(password_1) != str(password_2) :
  64. print("It seems like your password and it's confirmation are not the same, please try again.")
  65. if str(password_1) == str(password_2) :
  66. equal = True
  67. af = open("Main.txt", "a")
  68. text_af = str(username) + " " + str(password_1)
  69. af.write(text_af)
  70. af.write("\n")
  71. af.close()
  72. print("The program will now end itself, when you restart it, you'll be able to log in")
  73. time.sleep(5)
  74. sys.exit()
  75.  
  76. if answer_1 == int(2):
  77. equality = False
  78. username = str(input("What's your name? "))
  79. print("To keep your data safe, we work with passwords")
  80. while equality == False :
  81. password_1 = str(input("What do you chose as password? "))
  82. password_2 = str(input("Can you confirm this to be sure? "))
  83. if password_1 != password_2:
  84. print("It seems like your password and it's confirmation are not the same, please try again.")
  85. if password_1 == password_2:
  86. equality = True
  87. af = open("Main.txt", "a")
  88. text_af = str(username) + " " + str(password_1)
  89. af.write(text_af)
  90. af.write("\n")
  91. af.close()
  92. print("When you restart the program, you'll be able to log in.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement