Closed mcsimenc closed 11 months ago
Hello,
You have to decrease authentication panel's z-index so that the modal appear above it (or increase z-index of the modal) and then call showModal
at the top level of your server. Here's an example:
library(shiny)
library(shinymanager)
ui <- fluidPage(
tags$h2("My secure application"),
verbatimTextOutput("auth_output")
)
# Wrap your UI with secure_app
ui <- secure_app(
ui,
head_auth = tagList(
tags$style(".panel-auth {z-index: 123 !important;}")
)
)
server <- function(input, output, session) {
showModal(modalDialog("Welcome"))
## or you can display each time auth page is displayed (when disconnecting for example)
# observeEvent(input$shinymanager_where, {
# if (identical(input$shinymanager_where, "authentication")) {
# showModal(modalDialog("Welcome"))
# }
# })
res_auth <- secure_server(
check_credentials = check_credentials(data.frame(user = "user", password = "pwd"))
)
output$auth_output <- renderPrint({
reactiveValuesToList(res_auth)
})
# your classic server logic
}
shinyApp(ui, server)
Fantastic, thank you!
I'd like to show a modal before the authentication screen. Is this possible? Thanks!