datastorm-open / shinymanager

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

Disconnected from server before login #70

Closed SebastienGrall closed 3 years ago

SebastienGrall commented 3 years ago

Hello,

First, thanks for this package! I've tried to secure my app (without SQL database) but just after seeing the authentication page I'm disconnected from the server

disconnected

I've checked my logs :

... Listening on http://127.0.0.1:39723 Warning: Error in : Problem with filter() input ..1. ✖ Input ..1 must be of size 20602 or 1, not size 0. ℹ Input ..1 is Station == input$station. 63: Warning: Error in : Problem with filter() input ..1. ✖ Input ..1 must be of size 20602 or 1, not size 0. ℹ Input ..1 is Station == input$station. 64: Warning: Error in : Problem with filter() input ..1. ...

I use 3 files : global.R, server.R and ui.R

First use of filter function in my server.R

`output$titre <- renderText({

  migrateurs<-subset(migrateurs,Station == data$clickedMarker$id)

  data_stac_non_seino<-subset(data_stac_non_seino,Station == data$clickedMarker$id)

  return(if(is.null(data$clickedMarker$id)){NULL}
         else{
           if(sum(as.numeric(unique(migrateurs %>%
                                    filter(Station == data$clickedMarker$id) %>%
                                    filter(Date==max(Date)) %>%
                                    .[[1]])))==0){
             if(sum(as.numeric(unique(data_stac_non_seino %>%
                                      filter(Station==data$clickedMarker$id) %>%
                                      filter(MAJ==max(MAJ)) %>%
                                      .[[1]])

             ))==0){NULL}else{paste("<b>Remontées annuelles")}

           }else{paste("<b>Remontées annuelles")}
         })

  })`

Sébastien

pvictor commented 3 years ago

Hello,

This error is caused by using NULL in dplyr::filter, e.g. :

dplyr::filter(iris, Species == NULL)

This might be solved using :

req(data$clickedMarker$id)

at the start of any reactive context where the value is used.

Victor

SebastienGrall commented 3 years ago

Works perfectly, thanks Victor