I'm fairly new to Java and I'm facing some difficulties. So i've been instructed to run a program where you will login in to a system by entering a pin number and school name. You have 3 attempts for each until a message prompts that tells you that the login has failed. My problem is. Everything is fine but in PIN SECTION, (userInputPin==PIN) section, it automatically inputs "Attempt #2 - Enter your school name - Incorrect. upon first correct attempt. When writing the correct school name, it shows login failed as well when it should notify that you have logged in. What's the error?
Note:Ignore comment, I'll fix them.
public class Login {
    public static final int PIN = 1234; //Declaring constant for fixed PIN
    //Declaring constant for first school name
    public static final String FIRST_SCHOOL = "St. Charles"; 
    public static void main(String[] args) {
        Scanner kb = new Scanner (System.in); //Declaring scanner object
        int attempts = 1; //Declaring variable for attempt number
        //Printing first paragraph section of the program
        System.out.println("This program simulates logging into a bank account,"
                + "\nasking certain questions for security.\n");
        // PIN Section
        while(attempts<=3) //While loop
        {
          System.out.print("Attempt #"+attempts+" - Enter PIN: "); 
          int userInputPin = kb.nextInt(); //User inputs pin number
          //Conditional situations
          if(userInputPin==PIN)
          {
              attempts=1;
              while(attempts<=3)
        {
            System.out.print("\nAttempt #"+ attempts+" - Enter your first school: ");
            String userInputSchool = kb.next();
            //Conditional situations
            if(userInputSchool.equals(FIRST_SCHOOL))
                {
                System.out.println("\nYou're logged in.");
                }
            else{
                if(attempts==3)
                {
                    System.out.println("\nLogin failed.");
                }
                else
                {
                    System.out.println("Incorrect.\n");
                }
            }
           attempts++;
        }
          }
          else{
              if(attempts==3){
                  System.out.println("\nLogin failed.");
              }
              else{
                  System.out.println("Incorrect.\n");
              }
          }
        attempts++; //Increments attempt by 1 when PIN is incorrect          
        }
 
    