0

I have read this page about creating a login page: Starting Shiny app after password input

and try to combine the code of login page with my app.

However, I have no idea how to display multiple outputs (including tabPanel, navbarMenu, plots, tables, and some dynamic items embedded in renderUI) by modifying the part of ui:

ui2 <- function(){tagList(tabPanel("Test"))}

and the part of server:

if (USER$Logged == TRUE) 
{
  output$page <- renderUI({
    div(class="outer",do.call(navbarPage,c(inverse=TRUE,title = "Contratulations you got in!",ui2())))
  })
  print(ui)
}

I have tried

source("ui.R")

of my app, but the images of the app cannot be found and displayed through this source function. Also, some dynamic outputs using "renderUI" in server.R cannot be displayed, because I failed to source server.R of my app within the code of login page.

Can I combine the login page with my app by the "source" function? Or do I need to combine all the code (login page and my app) together within one R script?

Jessie
  • 51
  • 5
  • I will update my post in coming weeks as a lot are interested in this functionality with usernames and passwords. Anyhow, first make sure you `source(ui.r,local = T)`. Then simply put everything inside the `server`, the idea behind is simple: create 2 `ui` for login and for the app itself – Pork Chop Jul 09 '17 at 18:06
  • @PorkChop Really appreciate it! Thanks in advanced. In fact, I've tried to source my app by modifying the part of ui like this: ui2 <- function(){ source("ui.R", local = T) } and modify the part of server like this: if (USER$Logged == TRUE) { output$page <- renderUI({ div(class="outer",ui2()) }) print(ui) } I put these source file and the www folder under the folder where the login app is. But, why the images are not found when I source my app? – Jessie Jul 10 '17 at 13:23
  • @PorkChop Also, may I ask how to source the server.r of my app? Can I source the server.r like this: if (USER$Logged == TRUE) { output$page <- renderUI({ source("server.R", local = T) div(class="outer",ui2()) }) print(ui) }? Many thanks! – Jessie Jul 10 '17 at 13:25
  • @PorkChop, Did you get a chance to update a new article you mentioned about. it will be really helpufl. Appreciate your help I have been trying to implement the same. jessie, Did you find any solution? appreciate any direction on how to approach this issue – user5249203 Sep 25 '17 at 18:27
  • @user5249203 Not yet. I still have some problem about sourcing my server.R and ui.R to the password.R. If you have some idea, appreciate to discuss with you. – Jessie Nov 04 '17 at 04:40

0 Answers0