datastorm-open / shinymanager

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

How change position of “Logout” and menu for “shinymanager” R package? #78

Closed andirey closed 3 years ago

andirey commented 3 years ago

I use "shinymanager" to auth users for R Shiny dashboard. By default, the position of the menu with "Logout" button is the "right bottom" corner.

ui <- secure_app(UI) Any ideas on how to change position on let say "right top" corner?

Thanks!

Link https://stackoverflow.com/questions/65389665/how-change-position-of-logout-and-menu-for-shinymanager-r-package

howardbaek commented 3 years ago

Have a look at #75

andirey commented 3 years ago

Thanks! Is it possible to move the "Logout" button on the right top corner?

howardbaek commented 3 years ago

@pvictor is saying its not possible. Coming soon. #75

pvictor commented 3 years ago

If you re-install from GitHub, there's a new argument fab_position in secure_app to specify FAB button position. Example:


credentials <- data.frame(
  user = c("shiny", "shinymanager"),
  password = c("123", "456"),
  stringsAsFactors = FALSE
)

library(shiny)
library(shinymanager)

ui <- fluidPage(
  tags$h2("My secure application"),
  verbatimTextOutput("auth_output")
)

# Wrap your UI with secure_app
ui <- secure_app(ui, fab_position = "top-right") # <- set position of FAB button here

server <- function(input, output, session) {

  res_auth <- secure_server(
    check_credentials = check_credentials(credentials)
  )

  output$auth_output <- renderPrint({
    reactiveValuesToList(res_auth)
  })

  # your classic server logic

}

shinyApp(ui, server)

Victor

howardbaek commented 3 years ago

@pvictor I re-downloaded the package from Github and used the fab_position argument, and I got this message:

Warning: Error in isTRUE: object 'lang' not found
  [No stack trace available]

I re-downloaded the package from CRAN, and this message disappears, leading me to think this message came from the Github version!

FreyGeospatial commented 2 years ago

fab_position = "bottom-left" in the CRAN version makes the logout button disappear altogether. Haven't tried the github version. Anyone else having that bug?

pvictor commented 2 years ago

@FreyGeospatial , with example above, CRAN version, and Chrome or Firefox, I see :

image

Please open a new issue with a reproducible example if possible and more (browser, type of shiny app, ...)

Victor

andresmorago commented 2 years ago

Hello Im trying to change the location of the icon. I used the fab_position = "bottom-left" but the icon disappears.

ui <- secure_app(
                 head_auth = tags$script(inactivity),
                 theme = shinythemes::shinytheme("cerulean"),
                 enable_admin = T,
                 tags_top = tags$img(
                   src = "logo-s.png", width = 130),
                 language = "es",
                 fab_position = "bottom-left",
                 fluidPage( ..... )
                 )

image

Using the parameter fab_position = "bottom-right" will show the icon back again

ui <- secure_app(
                 head_auth = tags$script(inactivity),
                 theme = shinythemes::shinytheme("cerulean"),
                 enable_admin = T,
                 tags_top = tags$img(
                   src = "logo-s.png", width = 130),
                 language = "es",
                 fab_position = "bottom-right",
                 fluidPage( ..... )
                 )

image

FreyGeospatial commented 2 years ago

@andresmorago I've opened up the issue here. The issue seems to be the sidebar hiding the button- still waiting on a fix in the next release.