datastorm-open / shinymanager

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

fileInput(placeholder = "No file selected") is being overwritten by authenticated user name in Firefox #122

Open gdmcdonald opened 2 years ago

gdmcdonald commented 2 years ago

After login, the default value of the placeholder text in a file upload UI element, "No file selected" is being over written by the username of the authenticated user. This only happens in Firefox, and not in Chrome or RStudio browser.

In Chrome (Version 94.0.4606.81 (Official Build) (x86_64)), Desired behavior: Screen Shot 2021-10-13 at 2 58 00 pm

In Firefox (93.0 (64-bit)), Undesired behavior: Screen Shot 2021-10-13 at 2 58 05 pm

Minimal Working Example:

library(shiny)
library(shinymanager)

#login data
credentials <- data.frame(
  user = c("demo_user"),
  password = c("password"),
  stringsAsFactors = FALSE
)

# Upload UI element
uploadUI <- function(id) {
  # Input: Select a file ----
  fileInput(inputId = "uploaded_files", 
            label = "Choose .zip file(s)",
            placeholder = "No file selected")
}

# Define UI for application
ui2 <- fluidPage(title = "Example", uploadUI(1))

# Wrap UI with secure_app
ui <- secure_app(ui = ui2, choose_language = F)

# server
server <- function(input, output) {
  # check_credentials returns a function to authenticate users
  res_auth <- secure_server(check_credentials(credentials))
}

# Run the application 
shinyApp(ui = ui, server = server)
pvictor commented 2 years ago

That's a good one 😆 0 ideas of what might be causing it tho...