无法获取当前用户的信息
Can't get the information for the current user
正如您在下面的代码中看到的,成功登录后,它应该打印包含用户、管理员评论和凭证数据框中的 start/expiring 日期的用户信息,页。但是,它没有显示。可能是什么问题呢?感谢指导。
# define some credentials
credentials <- data.frame(
user = c("11", "1", "1", "1"), # mandatory
password = c("1", "1", "1", "1"), # mandatory
start = c("2022-02-14"), # optinal (all others)
expire = c(NA, "2019-12-31"),
admin = c(TRUE, TRUE, FALSE, FALSE),
comment = "Welcom to the Shiny applications.",
stringsAsFactors = FALSE
)
library(shiny)
library(shinymanager)
ui<-fluidPage(
navbarPage(
"Shiny",
tabPanel(
"Information"),
tags$h2("Information about the current user"),
verbatimTextOutput("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 <- renderPrint({
reactiveValuesToList(res_auth)
})
# your classic server logic
}
shinyApp(ui, server)
您的 navbarPage
:
中需要一个面板,例如 mainPanel
ui<-fluidPage(
navbarPage(
"Shiny",
tabPanel(
"Information"),
tags$h2("Information about the current user"),
mainPanel(
verbatimTextOutput("auth_output")
)
)
)
我的错,修正了,菜鸟错误,谢谢。
# define some credentials
credentials <- data.frame(
user = c("11", "1", "1", "1"), # mandatory
password = c("1", "1", "1", "1"), # mandatory
start = c("2022-02-14"), # optinal (all others)
expire = c(NA, "2019-12-31"),
admin = c(TRUE, TRUE, FALSE, FALSE),
comment = "Welcom to the Shiny applications.",
stringsAsFactors = FALSE
)
library(shiny)
library(shinymanager)
ui<-fluidPage(
navbarPage(
"Shiny",
tabPanel(
"Information",
tags$h2("Information about the current user"),
verbatimTextOutput("auth_output")
),
tabPanel("Simulation"),
tabPanel("Simulation"),
tabPanel("Simulation"),
tabPanel("Simulation")
)
)
# 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 <- renderPrint({
reactiveValuesToList(res_auth)
})
# your classic server logic
}
shinyApp(ui, server)
正如您在下面的代码中看到的,成功登录后,它应该打印包含用户、管理员评论和凭证数据框中的 start/expiring 日期的用户信息,页。但是,它没有显示。可能是什么问题呢?感谢指导。
# define some credentials
credentials <- data.frame(
user = c("11", "1", "1", "1"), # mandatory
password = c("1", "1", "1", "1"), # mandatory
start = c("2022-02-14"), # optinal (all others)
expire = c(NA, "2019-12-31"),
admin = c(TRUE, TRUE, FALSE, FALSE),
comment = "Welcom to the Shiny applications.",
stringsAsFactors = FALSE
)
library(shiny)
library(shinymanager)
ui<-fluidPage(
navbarPage(
"Shiny",
tabPanel(
"Information"),
tags$h2("Information about the current user"),
verbatimTextOutput("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 <- renderPrint({
reactiveValuesToList(res_auth)
})
# your classic server logic
}
shinyApp(ui, server)
您的 navbarPage
:
mainPanel
ui<-fluidPage(
navbarPage(
"Shiny",
tabPanel(
"Information"),
tags$h2("Information about the current user"),
mainPanel(
verbatimTextOutput("auth_output")
)
)
)
我的错,修正了,菜鸟错误,谢谢。
# define some credentials
credentials <- data.frame(
user = c("11", "1", "1", "1"), # mandatory
password = c("1", "1", "1", "1"), # mandatory
start = c("2022-02-14"), # optinal (all others)
expire = c(NA, "2019-12-31"),
admin = c(TRUE, TRUE, FALSE, FALSE),
comment = "Welcom to the Shiny applications.",
stringsAsFactors = FALSE
)
library(shiny)
library(shinymanager)
ui<-fluidPage(
navbarPage(
"Shiny",
tabPanel(
"Information",
tags$h2("Information about the current user"),
verbatimTextOutput("auth_output")
),
tabPanel("Simulation"),
tabPanel("Simulation"),
tabPanel("Simulation"),
tabPanel("Simulation")
)
)
# 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 <- renderPrint({
reactiveValuesToList(res_auth)
})
# your classic server logic
}
shinyApp(ui, server)