コード例 #1
0
  /**
   * Login.
   *
   * @return the string
   * @throws IOException Signals that an I/O exception has occurred.
   */
  public String login() throws IOException {
    boolean success = authenticationService.login(userName, password);

    if (!success) {
      FacesMessage facesMessage =
          new FacesMessage(FacesMessage.SEVERITY_ERROR, "", "Login ou senha inválidos");
      FacesContext.getCurrentInstance().addMessage(null, facesMessage);
      FacesContext.getCurrentInstance().responseComplete();
      return "loginFail";
    }

    return "loginSucess";
  }
コード例 #2
0
 /**
  * Gets the usuario logado.
  *
  * @return the usuario logado
  */
 public String getUsuarioLogado() {
   return authenticationService.getUsuarioLogado().getUsername();
 }
コード例 #3
0
 /**
  * Logout.
  *
  * @return the string
  */
 public String logout() {
   authenticationService.logout();
   return "login";
 }