@Override
    public void actionPerformed(ActionEvent e) {
        JButton button = (JButton) e.getSource();
        if (button == jbnLogin) {
            UserEntity user = new UserDAO().searchOneUser(jtfUser.getText());

            if (user == null) {
                JOptionPane.showMessageDialog(null, "No user with this name. Please, try again.");
                return;
            }

            if (jtfPass.getText() == null || !jtfPass.getText().equals(user.getPassword())) {
                JOptionPane.showMessageDialog(null, "Wrong password. Please, try again.");
                return;
            }

            if (user.getBlock().equals("y")) {
                JOptionPane.showMessageDialog(null, "User with this name is blocked.");
                return;
            }

            if (user.getRole().equals("a")) {
                dispose();
                new AdminFrame(user);
            }

            if (user.getRole().equals("u")) {
                dispose();
                new UserFrame(user);
            }

        }

        if (button == jbnExit) {
            dispose();
            System.exit(0);
        }
    }