I have a login screen to input user and pass. I want to keep the user id and use it as a filter parameter. Cant do it.. Please, some help.
resumo <- data.frame(
IDSIMULADO = c("300", "300","300"), # mandatory
MATRICULA = c("6162", "6100","6150"), # mandatory
QTDACERTO = c("71","77","81")
stringsAsFactors = FALSE
)
# define some credentials
credentials <- data.frame(
user = c("6162", "shinymanager"), # mandatory
password = c("123", "12345"), # mandatory
stringsAsFactors = FALSE
)
library(shiny)
library(shinymanager)
library(shinydashboard)
ui <- fluidPage(
tags$h2("My secure application")
,valueBoxOutput("acertos")
)
# Wrap your UI with secure_app
ui <- secure_app(ui)
server <- function(input, output, session) {
# call the server part
# check_credentials returns a function to authenticate users
res_auth <- secure_server(
check_credentials = check_credentials(credentials)
)
#filter some data using res_auth$user
dados <- resumo %>% filter(MATRICULA==res_auth$user,IDSIMULADO==300)
output$acertos <- renderValueBox({
valueBox(
paste0(dados$QTDACERTO[1]), "Questoes corretas", icon = icon("check"),
color = "purple"
)
})
}
shinyApp(ui, server)