private void checkLogin() { // 对输入进行基本的合法非法判断 String id = idTxt.getText(); String passwd = String.valueOf(passwordTxt.getPassword()); ResultMessage idResult = Utility.checkInputValid(id, 4, 14, false); ResultMessage passwdResult = Utility.checkInputValid(passwd, 5, 14, false); if (idResult != ResultMessage.SUCCESS) { MyOptionPane.showMessageDialog(null, "输入的用户名" + idResult.toFriendlyString() + "!"); return; } else if (passwdResult != ResultMessage.SUCCESS) { MyOptionPane.showMessageDialog(null, "输入的密码" + passwdResult.toFriendlyString() + "!"); return; } // 登录验证 ResultMessage loginresult = loginController.login(usertype.getSelectedIndex(), id, passwd); if (loginresult == ResultMessage.SUCCESS) { new HomeUI(loginController); frame.dispose(); } else { if (loginresult == ResultMessage.WRONG_ID) { MyOptionPane.showMessageDialog(null, "用户名错误!"); idTxt.setText(""); passwordTxt.setText(""); } else if (loginresult == ResultMessage.WRONG_PASSWD) { MyOptionPane.showMessageDialog(null, "密码错误!"); passwordTxt.setText(""); } else { MyOptionPane.showMessageDialog(null, "服务器未开启!"); } } }
@NotNull private String getToken() { return myToken.getText().trim(); }
@NotNull private String getRepoName() { return myRepoName.getText().trim(); }
@NotNull private String getRepoAuthor() { return myRepoAuthor.getText().trim(); }
String getSelectedFile() { return DrawFBP.makeAbsFileName(text2.getText(), text.getText()); }