/** * 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"; }
/** * Gets the usuario logado. * * @return the usuario logado */ public String getUsuarioLogado() { return authenticationService.getUsuarioLogado().getUsername(); }
/** * Logout. * * @return the string */ public String logout() { authenticationService.logout(); return "login"; }