public boolean validarClave() {
    boolean validado = true;

    if (!txtClave.getText().trim().equals(txtConfirmarClave.getText().trim())) {
      validado = false;
      JOptionPane.showMessageDialog(null, "Confirme su clave");
    }
    return validado;
  }
Exemplo n.º 2
0
 // Match passwords
 public boolean passwordsMatch(
     javax.swing.JPasswordField pwdPassword, javax.swing.JPasswordField pwdPasswordRetyped) {
   logManager.logInfo(
       "Entering 'passwordsMatch(javax.swing.JPasswordField pwdPassword, javax.swing.JPasswordField pwdPasswordRetyped)' method");
   boolean passwordsMatch = false;
   try {
     passwordsMatch = pwdPassword.getText().equals(pwdPasswordRetyped.getText());
   } catch (Exception exception) {
     logManager.logError(
         "Exception was thrown and caught in 'passwordsMatch(javax.swing.JPasswordField pwdPassword, javax.swing.JPasswordField pwdPasswordRetyped)' method");
   }
   logManager.logInfo(
       "Exiting 'passwordsMatch(javax.swing.JPasswordField pwdPassword, javax.swing.JPasswordField pwdPasswordRetyped)' method");
   return passwordsMatch;
 }
Exemplo n.º 3
0
  public void test() throws Exception {

    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtps");
    props.put("mail.smtps.host", SMTP_HOST_NAME);
    props.put("mail.smtps.auth", "true");
    props.put("mail.smtps.quitwait", "false");
    Session mailSession = Session.getDefaultInstance(props);
    mailSession.setDebug(true);

    Transport transport = mailSession.getTransport();
    MimeMessage message = new MimeMessage(mailSession);
    message.setFrom(new InternetAddress(username.getText()));
    message.setSubject(subject.getText());

    String s = msgfield.getText();
    message.setContent(s, "text/plain");
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(emailID.getText()));
    System.out.println("8i m here ");
    try {
      transport.connect(SMTP_HOST_NAME, SMTP_HOST_PORT, username.getText(), password.getText());
    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, "invalid username or password");
    }
    System.out.println("8i m here also yaar");
    // transport.sendMessage(message,message.getRecipients(Message.RecipientType.TO));
    transport.sendMessage(message123, message123.getAllRecipients());
    transport.close();
    System.out.println(s);
  }
Exemplo n.º 4
0
  public void actionPerformed(ActionEvent ae) {
    if (ae.getSource() == b1) {
      try {
        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection con =
            DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "123");
        PreparedStatement ps =
            con.prepareStatement("select * from LoginForm where username=? and password=?");
        String UserName = t1.getText();
        String Password = jp1.getText();
        ps.setString(1, UserName);
        ps.setString(2, Password);
        ResultSet rs = ps.executeQuery();
        boolean flag = rs.next();
        if (flag) {
          new Main();
          f.setVisible(false);
        } else {
          JOptionPane.showMessageDialog(null, "Please Enter valid Name And Password");
        }

      } catch (Exception e) {
        System.out.println("Error:" + e);
      }
    } else if (ae.getSource() == b2) {
      t1.setText("");
      jp1.setText("");
    } else if (ae.getSource() == b3) {

      f.setVisible(false);
    }
  }
Exemplo n.º 5
0
        @SuppressWarnings({"static-access", "deprecation"})
        public void actionPerformed(ActionEvent e) {
          if (txtFolio.getText().equals("")) {
            txtFolio.setText("");
            txtNombre.setText("");
            pxpClave.setText("");
            JOptionPane.showMessageDialog(
                null,
                "Ingrese un folio para realizar la función",
                "Aviso",
                JOptionPane.WARNING_MESSAGE);
            return;
          } else {
            Obj_Usuario usuario = new Obj_Usuario().buscar(Integer.parseInt(txtFolio.getText()));
            if (usuario.getFolio() != 0) {
              if (pxpClave.getText().equals("")) {
                JOptionPane.showMessageDialog(
                    null, "Inserte la contraseña.", "Aviso", JOptionPane.WARNING_MESSAGE);
                return;
              } else {
                Obj_MD5 algoritmo = new Obj_MD5();
                String cadena = algoritmo.cryptMD5(pxpClave.getText(), "izagar");
                String clave = usuario.getContrasena();

                System.out.println("pxp=" + cadena + "  bd=" + clave);
                System.out.println(cadena.length() + " " + clave.length());
                if (!clave.equals(cadena)) {
                  txtFolio.setText("");
                  txtNombre.setText("");
                  pxpClave.setText("");
                  JOptionPane.showMessageDialog(
                      null, "La contraseñas no es valida", "Aviso", JOptionPane.WARNING_MESSAGE);
                  return;
                } else {
                  dispose();
                  new Principal().setVisible(true);
                }
              }

            } else {
              JOptionPane.showMessageDialog(
                  null, "El Usuario no existe", "Aviso", JOptionPane.WARNING_MESSAGE);
              return;
            }
          }
        }
Exemplo n.º 6
0
 @SuppressWarnings("deprecation")
 private void login() {
   if (txtUsername.getText().length() > 0 && txtPassword.getText().length() > 0) {
     User user = new User();
     user.username = txtUsername.getText();
     user.password = txtPassword.getText();
     if (user.authenticate() == true) {
       dispose();
       M.form_menu.setVisible(true);
     } else {
       clear();
     }
   } else {
     clear();
     M.messageBox("Please enter a username and a password.");
   }
 }
 public boolean validarTexto() {
   boolean validado = true;
   if (txtNombreDoctor.getText().trim().equals("")
       || txtApellido.getText().trim().equals("")
       || txtTelefono.getText().trim().equals("")
       || txtCelular.getText().trim().equals("")
       || txtCedula.getText().equals("")
       || txtUsuario.getText().trim().equals("")
       || txtClave.getText().trim().equals("")
       || txtConfirmarClave.getText().trim().equals("")
       || txtAlergias.getText().trim().equals("")
       || txtCirujias.getText().equals("")
       || txtNombreContacto.getText().equals("")
       || txtTelefonoContacto.getText().equals("")
       || cmbTipoSangre.getSelectedItem().equals("Seleccionar")) {
     validado = false;
     JOptionPane.showMessageDialog(null, "Faltan Campos por llenar");
   }
   return validado;
 }
Exemplo n.º 8
0
 @SuppressWarnings("deprecation")
 @Override
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().equals("Conectar")
       && database.getText().length() != 0
       && host.getText().length() != 0
       && user.getText().length() != 0
       && password.getText().length() != 0) {
     SQLLinker linker = new SQLLinker(user.getText(), password.getText());
     try {
       linker.startConnection(database.getText(), host.getText());
       new MainWindow("SQL App", linker);
       this.dispose();
     } catch (SQLException ex) {
       JOptionPane.showMessageDialog(this, ex);
     }
   } else if (e.getActionCommand().equals("Cancelar")) {
     this.dispose();
   }
 }
Exemplo n.º 9
0
 public void actionPerformed(ActionEvent evt) // event handling
     {
   // Object source = evt.getSource(); //get who generates this event
   String arg = evt.getActionCommand();
   if (arg.equals("Register")) { // determine which button is clicked
     UName = UsernameField.getText(); // take actions
     PsWord = PasswordField.getText();
     PsWord1 = PasswordField1.getText();
     Acct = new Account(UName, PsWord, PsWord1);
     if (Acct.signUp())
       JOptionPane.showMessageDialog(
           null, "Account has been created!", "Confirmation", JOptionPane.INFORMATION_MESSAGE);
     else
       JOptionPane.showMessageDialog(
           null,
           "Account creation failed due to an invalid email address or unmatched passwords or the email address exists.",
           "Confirmation",
           JOptionPane.INFORMATION_MESSAGE);
   }
 }
Exemplo n.º 10
0
 public void actionPerformed(ActionEvent ae) {
   String user = t1.getText();
   String pass = t2.getText();
   if (ae.getSource() == b1) {
     if (pass.equals("netmon")) {
       NetPac pAn = new NetPac();
       this.setVisible(false);
     } else {
       JOptionPane.showMessageDialog(null, "Error!! Enter correct password.");
     }
   }
 }
Exemplo n.º 11
0
  public void actionPerformed(ActionEvent e) {

    if (e.getSource() == signin) {

      System.out.println(checkValidations());

      if (checkValidations().equals("yes")) {
        String userName = userNameText.getText(); // perform your operation
        System.out.println(userName);
        String password = passwordText.getText(); // perform your operation
        System.out.println(password);

        UserLogin userLogin = UserLoginBao.getUserNameAndPassword(userName, password);
        System.out.println("user info" + userLogin);

        if (userLogin != null) {
          if (userName.equals(userLogin.getUserName())) {
            System.out.println("yes enter");
            JFrame frame = new JFrame("Demo application");
            System.out.println("1");
            TabbedPanelExample mainFrame = new TabbedPanelExample(frame, userLogin);
            System.out.println("2");
            frame.setSize(1350, 700);
            System.out.println("3");
            frame.setVisible(true);
            this.frame.dispose();
          } else {
            JOptionPane.showMessageDialog(null, "Please Enter Valid UserName or Password");
          }
        } else {
          JOptionPane.showMessageDialog(null, "Please Enter Valid UserName or Password");
        }
      }
    }

    if (e.getSource() == cancle) {
      userNameText.setText(""); // perform your operation
      passwordText.setText(""); // perform your operation
    }

    if (e.getSource() == signup) {
      this.frame.dispose();
      JFrame frame = new JFrame("Demo application");
      Signup signup = new Signup(frame);
      frame.setSize(1350, 700);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      JPanel panel = new JPanel();
      panel.setBackground(new Color(216, 191, 216));
      frame.add(panel);
      signup.placeComponents(panel);
      frame.setVisible(true);
    }
  }
Exemplo n.º 12
0
  public static void getUserInfo(String path, String fileName, Object[] o) throws Exception {
    Map userMap = new HashMap();
    if (o.length > 0) {
      for (Object s : o) {
        JTextComponent f = (JTextComponent) s;
        if (!StringUtil.isEmptyString(f.getText().trim())) {
          if (f.getClass() == JTextField.class) {
            JTextField jtf = (JTextField) f;
            logger.debug("[key = " + jtf.getName() + ",value = " + jtf.getText().trim() + "]");
            userMap.put(jtf.getName(), jtf.getText().trim());
          }
          if (f.getClass() == JPasswordField.class) {
            JPasswordField jpf = (JPasswordField) f;
            logger.debug("[key = " + jpf.getName() + ",value = " + jpf.getText().trim() + "]");
            userMap.put(jpf.getName(), jpf.getText().trim());
          }
        }
      }
    }

    writeFile(userMap, path, fileName);
  }
Exemplo n.º 13
0
  @SuppressWarnings("deprecation")
  @Override
  public void actionPerformed(ActionEvent ae) {
    Object source = ae.getSource();
    if (source == jbtnOK) {
      Login = jtfLogin.getText().toString();
      Password = jpsPassword.getText().toString();
      allIsOK = true;
      jPanelLoG.setVisible(false);
    }
    // TODO Auto-generated method stub

  }
Exemplo n.º 14
0
 private WorkingCopy getWorkingCopy() {
   try {
     WorkingCopy workingCopy =
         new WorkingCopy(
             _name.getText(),
             _username.getText(),
             _password.getText(),
             _url.getText(),
             _local.getSelectedFile().getAbsolutePath());
     return workingCopy;
   } catch (Exception e) {
     return null;
   }
 }
Exemplo n.º 15
0
  /*
   * Ersteller: Burgstaller
   * Funktionname: logout
   * Paramterliste:
   *
   * Funktion:
   *            loggt den User aus und beendet somit die Arbietszeit
   */
  public void logout() {
    String passwort = logout_passwort_passwordfield.getText();
    MitarbeiterDao dao = new MitarbeiterDao();
    Mitarbeiter mb = dao.getMitarbeiterByUsername(username);

    if (mb.getPasswort().equals(passwort)) {
      editMitarbeiterstunde(mb);

      this.dispose();
      Login.mw.dispose();
      Login l = new Login();
    } else {
      JOptionPane.showMessageDialog(this, "Falsches Passwort!");
    }
  } // #logout
 private void onOK() {
   try {
     Map<String, String> data = new HashMap<String, String>();
     data.put("login", loginField.getText());
     data.put("password", passwordField.getText());
     String errorMsg = SocketManager.doAction(Constants.LOGIN_ACTION, data);
     if (errorMsg.equals("0")) {
       MainView mainView = new MainView();
       mainView.setVisible(true);
       dispose();
     } else {
       JOptionPane.showMessageDialog(this, errorMsg, "Error!", JOptionPane.ERROR_MESSAGE);
     }
   } catch (IOException e) {
     JOptionPane.showMessageDialog(this, e.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE);
   }
 }
Exemplo n.º 17
0
 private void cargarUsuarios() {
   try {
     usuarios.setNombreusuario(txtUsuario.getText());
     usuarios.setClaveusuario(txtContraseña.getText());
     usuarios.setEstado("Activo");
     personas = impPersonas.getUnaPersona(Integer.parseInt(txtDniUsuario.getText()));
     usuarios.setPersonas(personas);
     usuarios.setTipo(personas.getPerfil());
     impUsuarios.insert(usuarios);
     JOptionPane.showMessageDialog(rootPane, "Usuario cargado correctamente");
   } catch (IndexOutOfBoundsException e) {
     JOptionPane.showMessageDialog(rootPane, "El DNI ingresado no es correcto...");
   } catch (NumberFormatException e) {
     JOptionPane.showMessageDialog(
         rootPane, "El DNI debe ingresarse correctamente... ej: 11562898");
   }
 }
Exemplo n.º 18
0
 @Override
 public void actionPerformed(ActionEvent event) {
   if (event.getSource() == b1) {
     usr = t1.getText();
     psd = p1.getText();
     if ((usr.equals("admin")) && (psd.equals("admin"))) {
       JOptionPane.showMessageDialog(
           (Component) null, "Access Granted", "Authentication", JOptionPane.OK_CANCEL_OPTION);
     } else {
       JOptionPane.showMessageDialog(
           (Component) null,
           "Enter a valid Username and Password",
           "Login Error",
           JOptionPane.OK_CANCEL_OPTION);
     }
   }
   if (event.getSource() == b2) {
     System.exit(0);
   }
 }
Exemplo n.º 19
0
  public void actionPerformed(ActionEvent e) {
    String s = new String(e.getActionCommand());

    if ((s).equals("Login")) {
      try {
        if (factory.authenticate(username.getText(), password.getText())) {
          loginFrame.dispose();
          new HomeScreen(factory);
        } else {
          JOptionPane.showMessageDialog(loginFrame, "Username or Password is incorrect.");
        }
      } catch (SQLException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }

    } else if ((s).equals("Cancel")) {
      loginFrame.dispose();
      new ExitListener();
    }
  }
Exemplo n.º 20
0
  @SuppressWarnings("deprecation")
  public void logar() {
    SistemaAcesso sist = new SistemaAcesso();
    sist.addArrayList();

    try {
      if (sist.buscarLogin(tlogin.getText(), tsenha.getText())) {

        GUIMenuPrincipal menu = new GUIMenuPrincipal(bn, sist.getPerfil(), sist.getAgencia());
        menu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        dispose();
      } else {
        tsenha.setText("");
        tlogin.setText("");
        JOptionPane.showMessageDialog(null, "Login e/ou senha incorretos");
        tlogin.requestFocus();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 21
0
  public void actionPerformed(ActionEvent event) {
    if (event.getActionCommand() == "Submit") {

      Id = useridTxt.getText();
      Password = passwordTxt.getText();

      if (Id.equalsIgnoreCase("admin") && Password.equalsIgnoreCase("admin")) {

        BrainMain.registerPatients.setEnabled(true);
        BrainMain.tumorIdentification.setEnabled(true);
        BrainMain.reports.setEnabled(true);
        BrainMain.about.setEnabled(true);
        setVisible(false);

      } else {
        JOptionPane.showMessageDialog(this, "Invalid Login Details");
      }
    }

    if (event.getActionCommand() == "Exit") {
      System.exit(0);
    }
  }
Exemplo n.º 22
0
  private boolean resetAndUpdateDatabaseLoaderIfChanged() {
    DatabaseLoader dbl = (DatabaseLoader) m_dsLoader.getLoader();
    String url = dbl.getUrl();
    String user = dbl.getUser();
    String password = dbl.getPassword();
    String query = dbl.getQuery();
    String keys = dbl.getKeys();
    File propsFile = dbl.getCustomPropsFile();

    boolean update =
        (!url.equals(m_dbaseURLText.getText())
            || !user.equals(m_userNameText.getText())
            || !password.equals(m_passwordText.getText())
            || !query.equalsIgnoreCase(m_queryText.getText())
            || !keys.equals(m_keyText.getText()));

    if (propsFile != null && m_dbProps.getText().length() > 0) {
      update = (update || !propsFile.toString().equals(m_dbProps.getText()));
    } else {
      update = (update || m_dbProps.getText().length() > 0);
    }

    if (update) {
      dbl.resetStructure();
      dbl.setUrl(m_dbaseURLText.getText());
      dbl.setUser(m_userNameText.getText());
      dbl.setPassword(new String(m_passwordText.getPassword()));
      dbl.setQuery(m_queryText.getText());
      dbl.setKeys(m_keyText.getText());
      if (m_dbProps.getText() != null && m_dbProps.getText().length() > 0) {
        dbl.setCustomPropsFile(new File(m_dbProps.getText()));
      }
    }

    return update;
  }
Exemplo n.º 23
0
  private boolean validateData() {

    if (txtUser.getText().trim().length() == 0) {
      JOptionPane.showMessageDialog(
          null,
          ConstantMessages.REQUIRED_USERNAME,
          ConstantMessages.ERROR_TITLE,
          ConstantMessages.ERROR_ICON);
      txtUser.requestFocus();
      return false;
    }

    if (txtPassword.getText().trim().length() == 0) {
      JOptionPane.showMessageDialog(
          null,
          ConstantMessages.REQUIRED_PASSWORD,
          ConstantMessages.ERROR_TITLE,
          ConstantMessages.ERROR_ICON);
      txtPassword.requestFocus();
      return false;
    }

    return true;
  }
Exemplo n.º 24
0
 /**
  * This method gets Password Converting textFieldPassword into a String and gets password
  *
  * @return password
  */
 public String getPassword() {
   password = passwordField.getText();
   return password;
 }
Exemplo n.º 25
0
  public void actionPerformed(ActionEvent e) {
    p2.str1 = fn1.getText();
    p2.str2 = ln1.getText();
    p2.str3 = un1.getText();
    p2.str4 = ps11.getText();
    p2.str5 = eid1.getText();
    p2.str6 = ps21.getText();
    p2.str7 = mb1.getText();
    p2.str8 = cct1.getText();
    p2.str9 = hquali1.getText();
    p2.str10 = dober1.getText();
    p2.str11 = dober2.getText();
    p2.str12 = dober3.getText();
    p2.str13 = p2.str10 + "/" + p2.str11 + "/" + p2.str12;

    boolean bl1, bl2, bl3, bl4, bl5, bl6, bl7, bl8, bl9;
    bl1 = false;
    bl2 = false;
    bl3 = false;
    bl4 = false;
    bl5 = false;
    bl6 = false;
    bl7 = false;
    bl8 = false;

    if (str1.length() > 0) {
      // er1.setForeground(null);
      er1.setText("");
      fn1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl1 = true;
      repaint();
    } else {
      er1.setForeground(Color.red);
      er1.setText("(First name can't be null)");
      fn1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if (str3.length() > 0) {
      er3.setText("");
      un1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl2 = true;
      repaint();

    } else {
      er3.setForeground(Color.red);
      er3.setText("(Username can't be null)");
      un1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if (str5.length() > 0) {
      er6.setText("");
      eid1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl3 = true;
      repaint();

    } else {
      er6.setForeground(Color.red);
      er6.setText("(email id can't be null)");
      eid1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if (str4.length() > 0) {
      er4.setText("");
      ps11.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl4 = true;
      repaint();

    } else {
      er4.setForeground(Color.red);
      er4.setText("(Password can't be null)");
      ps11.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if ((str4.equals(str6))) {
      str6 = str4;
      er5.setForeground(null);
      er5.setText("");
      ps21.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl5 = true;
      repaint();

    } else {
      er5.setForeground(Color.red);
      er5.setText("(both pwd should be same)");
      ps21.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }
    if (str7.length() == 10) {
      er7.setText("");
      mb1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl6 = true;
      repaint();

    } else {
      er7.setForeground(Color.red);
      er7.setText("(number should be of 10 digit)");
      mb1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }
    if (str8.length() > 0) {
      er8.setText("");
      cct1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl7 = true;
      repaint();

    } else {
      er8.setForeground(Color.red);
      er8.setText("(Current City can't be null)");
      cct1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }
    if (str9.length() > 0) {
      er9.setText("");
      hquali1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl8 = true;
      repaint();

    } else {
      er9.setForeground(Color.red);
      er9.setText("(Highest Qualif. can't be null)");
      hquali1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    try {
      if ((bl1 && bl2 && bl3 && bl4 && bl5 && bl6 && bl7 && bl8) == true) {
        JOptionPane.showMessageDialog(null, "Data submitting ");
        p2.goer();
      }
    } catch (Exception e3) {
    }
  }
 @SuppressWarnings("deprecation")
 public String getPassword() {
   return passwordField.getText();
 }
Exemplo n.º 27
0
 String getPassword() {
   return txtPassword.getText();
 }
Exemplo n.º 28
0
 @Override
 public void saveSettings() {
   BongTVPlugin.getBongTVData().setUser(tfBenutzer.getText());
   BongTVPlugin.getBongTVData().setPassword(tfPasswort.getText());
   BongTVPlugin.getInstance().save();
 }
Exemplo n.º 29
0
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    String name = user.getText();
    String passWord = passWd.getText();

    if (cmd.equals("登录")) {
      if (name.length() != 4 && name.length() != 5 && name.length() != 8) {
        JOptionPane.showMessageDialog(null, "亲,用户名长度出错!");
        Tip();
      } else {
        person = Dao.check(name, passWord);
        // 通过判断该人的身份来新建不同窗口
        // 管理员
        if (person instanceof Operator) {
          Operator op = (Operator) person;
          // System.out.println(p.name);
          if (op.getName() != null) { // 判断该用户是否有效
            if (checktflogin.getText().equals(randomphoto.getSRand())) {
              flogin.dispose();
              Administrator ad = new Administrator(op);
              ad.setVisible(true);
              userNames = op.getName();
            } else {
              identifyError();
            }
          } else {
            noAuthority();
          }
        } else if (person instanceof Student) {
          // 学生
          Student st = (Student) person;
          if (st.getName() != null) { // 判断该用户是否有效
            if (checktflogin.getText().equals(randomphoto.getSRand())) {
              flogin.dispose();
              StudentFrame se = new StudentFrame(st);
              se.setVisible(true);
              userNames = st.getName();
            } else {
              identifyError();
            }
          } else {
            noAuthority();
          }
        } else if (person instanceof Teacher) {
          // 老师
          Teacher tea = (Teacher) person;
          if (tea.getName() != null) { // 判断该用户是否有效
            if (checktflogin.getText().equals(randomphoto.getSRand())) {
              flogin.dispose();
              TeacherFrame te = new TeacherFrame(tea);
              te.setVisible(true);
              userNames = tea.getName();
            } else {
              identifyError();
            }
          } else {
            noAuthority();
          }
        }
      }
    } else if (cmd.equals("重置")) {
      Tip();
    }
  }
Exemplo n.º 30
0
 public boolean validaFuncionario() {
   if (usuario != null)
     return jtLogin.getText().equals(usuario.getLogin())
         && jtSenha.getText().equals(usuario.getSenha());
   else return false;
 }