Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 具有用户身份验证的闪亮仪表板_R_Shiny_Shinydashboard - Fatal编程技术网

R 具有用户身份验证的闪亮仪表板

R 具有用户身份验证的闪亮仪表板,r,shiny,shinydashboard,R,Shiny,Shinydashboard,我正在制作一个闪亮的应用程序,它将显示一个仪表板,但在此之前,它将要求用户登录。有两个ui,ui_登录和ui_应用程序,但在ui_应用程序中,如果我使用fluidPage/fixedPage或其他替代仪表板页面,则工作正常。是否有任何方法可以在登录后显示仪表板页面 library(shiny) library(shinydashboard) my_username = "user" my_password = "pass" ui <- uiOutput("page") ui_logi

我正在制作一个闪亮的应用程序,它将显示一个仪表板,但在此之前,它将要求用户登录。有两个ui,ui_登录和ui_应用程序,但在ui_应用程序中,如果我使用fluidPage/fixedPage或其他替代仪表板页面,则工作正常。是否有任何方法可以在登录后显示仪表板页面

library(shiny)
library(shinydashboard)

my_username = "user"
my_password = "pass"

ui <- uiOutput("page")

ui_login <- fluidPage(
  div(
    textInput("username", "Username"),
    passwordInput("passwd", "Password"),
    br(),
    actionButton("Login", "Log In"),
    uiOutput("invalid")
  )
)

ui_app <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody()
)

server <- function(input, output, session) {
  #app server code-----

  observe({
    if(USER$Logged == FALSE) {
      if(!is.null(input$Login)) {
        if(input$Login > 0) {
          Username <- isolate(input$username)
          Password <- isolate(input$passwd)
          if((Username == my_username) & (Password == my_password)){
            USER$Logged = TRUE
          }
          else {
            output$invalid <- renderUI(h4("Please enter valid login credentials!", style="color:red;"))
          }
        }
      }
    }
    else {
      output$invalid <- renderUI(h4("Please enter valid login credentials!", style="color:red;"))
    }
  })
  observe({
    if(USER$Logged == FALSE) {
      output$page <- renderUI(ui_login) 
    }
    else {
      output$page <- renderUI(ui_app) 
    }
  })
}
shinyApp(ui, server)
库(闪亮)
图书馆(shinydashboard)
我的用户名=“用户”
我的密码=“通过”

ui我最近编写了一个R包,它提供了可以与shinydashboard集成的登录/注销模块


repo软件包中的
inst/
目录包含示例应用程序的代码。

我最近编写了一个R软件包,它提供了可以与shinydashboard集成的登录/注销模块


软件包repo中的
inst/
目录包含示例应用程序的代码。

我可以使用
shinny model
建议登录页面吗