@FXML
  void loginAction() {
    try {
      credenciais.setLogin(textLogin.getText());
      credenciais.setSenha(textPassword.getText());
      securityContext.login();

      if (securityContext.isLoggedIn()) {
        buttonLogin.getScene().getWindow().hide();
      } else {
        errorMessage.setText(resources.getString("login.errorMessage"));
        showMessageError();
      }
    } catch (Exception exception) {
      ExceptionUtils.throwCustomerException(exception, false);
    }
  }
示例#2
0
  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws IOException, ServletException {

    if (!securityContext.isLoggedIn()) {
      String contextPath = ((HttpServletRequest) request).getContextPath();
      ((HttpServletResponse) response).sendRedirect(contextPath + "/index.html?destino=");
    } else {
      chain.doFilter(request, response);
    }
  }