コード例 #1
0
  public void Login() throws IOException {

    // TODO set username og password til en string istedet for at hent dem på den måde

    // if username field is empty = error message
    if (usernameText.getText().equals("")) {

      passwordErrorLbl.setVisible(false);
      usernameErrorLbl.setVisible(true);

      loginErrorLbl.setVisible(false);
    }
    // if passwordfield is empty = error message
    if (passwordText.getText().equals("")) {

      usernameErrorLbl.setVisible(false);
      passwordErrorLbl.setVisible(true);

      loginErrorLbl.setVisible(false);
    }

    if (passwordText.getText().equals("") && usernameText.getText().equals("")) {

      usernameErrorLbl.setVisible(true);
      passwordErrorLbl.setVisible(true);

      loginErrorLbl.setVisible(false);
    }

    if (logic.userAuth(usernameText.getText(), passwordText.getText())) {

      usernameErrorLbl.setVisible(false);
      passwordErrorLbl.setVisible(false);
      loginErrorLbl.setVisible(false);

      usernameText.clear();
      passwordText.clear();

      // TODO get menu to display currentuser

      myController.setScreen(Main.screenMenuID);

    } else {

      usernameErrorLbl.setVisible(false);
      passwordErrorLbl.setVisible(false);

      loginErrorLbl.setVisible(true);
    }
  }
コード例 #2
0
  public void logout() throws IOException {

    logic.setCurrentUser(null);
    myController.setScreen(Main.screenLoginID);
  }
コード例 #3
0
  public void newUserStage() throws IOException {

    myController.setScreen(Main.screenCreateUserID);
  }