title: Simple login script multiple users from file
body: <p>I have problem with my login script in Python 3.5.2.</p>
  
  <p>The problem with my code is that only first user in file <strong>users.txt</strong> can pass login. Second and third users get "Wrong username/password" message. What am I missing here ?</p>
  
  <p>Data in users.txt are formated like this:</p>
  
  <p><strong>Name|Surname|Role|ID|Username|Password</strong></p>
  
  <p>John|Johnson|Director|1|admin|admin</p>
  
  <p>Mike|Madson|CFO|2|mike|mike</p>
  
  <p>Problem is only John pass login and I need Mike as well.</p>
  
  <pre><code>def check():
  
      username = str(input("Username: "))
      password = str(input("Password: "))
  
      f = open("users.txt", "r")
      file_content = f.read()
      users = file_content.split("\n")
      for user in users:
          user_array = user.split("|")
          uname = user_array[4]
          pword = user_array[5]
          if uname == username and pword == password:
              print("Hello " + user_array[1] + ".")
              print("You are logged in as: " + user_array[2] + ".")
              main_menu()
          else:
              print("Wrong username/password.")
              print("Try again!\n\n")
              check()
  check()
  </code></pre>
  
  <p>Thanks for help!</p>