Closed MislavSag closed 5 years ago
Yes you can just replace all the conditions that wait for credentials()$user_auth
to be TRUE
before activating with your own custom condition that included the date predicate.
credentials <- callModule(shinyauthr::login, "login",
data = user_base,
user_col = user,
pwd_col = password_hash,
sodium_hashed = TRUE,
log_out = reactive(logout_init()))
logout_init <- callModule(shinyauthr::logout, "logout", reactive(credentials()$user_auth))
user_info <- reactive({credentials()$info})
my_condition <- reactive({
# all returns TRUE only if both conditions are TRUE
all(credentials()$user_auth, user_info()$enddate > Sys.Date())
})
observe({
if(my_condition()) {
shinyjs::removeClass(selector = "body", class = "sidebar-collapse")
} else {
shinyjs::addClass(selector = "body", class = "sidebar-collapse")
}
})
output$welcome <- renderText({
req(my_condition())
glue("{user_info()$name}")
})
It works. Thanks!
Along user and pass, Is it possible to add additional condition to enter shiny app?
More concretely, I would like to add date condition, that is date column for specific user have to be grater then today.
Something like this (server part):
Please look at observe part. This code doesn't work, but demonstrate what I want.