예제 #1
0
  /**
   * @author boconno3, elee3, asaini, rparames
   *     <p>This method will add a new user into the database by asking the user of the system for
   *     the characteristics of the user
   */
  private void addNewUser() {
    String name = view.showInputDialog("What is the name of the new user?");
    if (name == null) {
      return;
    }

    String password = view.showInputDialog("What is the password of the new user?");
    if (password == null) {
      return;
    }
    if (model.addUser(name, password)) {
      model.login(name, password);
      refresh();
    }
  }
예제 #2
0
  /**
   * @author boconno3, elee3, asaini, rparames
   *     <p>This method is a method which essentially is a log on menu which asks the user for their
   *     information and logs them in if the given info mathes information in the user database
   */
  private void login() {

    String name = view.showInputDialog("What is the name of the user?");
    if (name == null) {
      return;
    }

    String password = view.showInputDialog("What is the password of the user?");
    if (password == null) {
      return;
    }

    if (model.login(name, password)) {
      refresh();
      view.updateTree();
    }
  }