【发布时间】:2021-11-19 14:26:45
【问题描述】:
我尝试使用 print() 和 paste() 在同一行中打印文本和反应对象,但它不起作用。
# define some credentials
credentials <- data.frame(
user = c("shiny", "shinymanager"), # mandatory
password = c("azerty", "12345"), # mandatory
start = Sys.Date(), # optinal (all others)
expire = c(NA, "2019-12-31"),
admin = c(FALSE, TRUE),
comment = "Simple and secure authentification mechanism
for single ‘Shiny’ applications.",
stringsAsFactors = FALSE
)
library(shiny)
library(shinymanager)
ui <- fluidPage(
tags$h2("My secure application"),
uiOutput("auth_output")
)
# 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)
)
output$auth_output <- renderText({
print(paste0(h4("Name:"),h4(res_auth$user)))
})
# your classic server logic
}
shinyApp(ui, server)
【问题讨论】: