datastorm-open / shinymanager

Simple and secure authentification mechanism for single shiny applications.
https://datastorm-open.github.io/shinymanager/
381 stars 79 forks source link

Adding HTML elements over the login box created by secure_app #128

Open lefterisKl opened 2 years ago

lefterisKl commented 2 years ago

I would like to place a header tag (e.g. \<h3> ) above the login box created by secure_app. I have tried the tags_top parameter but it places the header inside the borders of the login box:

secure_app(ui,          
  tags_top = tags$div(tags$h3("Some title"))) #places the title inside the login box
pvictor commented 2 years ago

There's no option to do that, but you can still use an insertUI to put elements you want ino the page, e.g. :

library(shiny)
library(shinymanager)

ui <- secure_app(ui = fluidPage("Hello !"))

server <- function(input, output) {

  insertUI(
    selector = ".panel-auth", # target the fixed panel taking the whole page
    where = "afterBegin", 
    ui = tags$h1("HELLO!", class = "text-center")
  )

  secure_server(check_credentials(data.frame(
    user = "demo",
    password = "pass",
    stringsAsFactors = FALSE
  )))
}

shinyApp(ui = ui, server = server)

Victor