Giter VIP home page Giter VIP logo

Comments (3)

PaulC91 avatar PaulC91 commented on June 5, 2024

can you post a reproducible example here please? thanks.

from shinyauthr.

roman-tremmel avatar roman-tremmel commented on June 5, 2024

of course.... (sorry the first version was really buggy. Now the app should demonstrate my problem)

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyauthr)
library(tidyverse)

user_base <- data_frame(
    user = c("user1", "user2"),
    password = sapply(c("pass1", "pass2"), sodium::password_store), 
    permissions = c("admin", "standard"),
    name = c("User One", "User Two")
)

header <- dashboardHeaderPlus(userOutput("SUPER_USER"),
                              # you can add the button here.... but I want the button in the user dashboard see below. 
                              # in addition after log out the modal is showing, but without the log in fields. 
                              tags$li(class = "dropdown", style = "padding: 8px;",
                                      shinyauthr::logoutUI("logout"))
                              )
sidebar <- dashboardSidebar()
body = dashboardBody(shinyjs::useShinyjs())
ui <- dashboardPagePlus(header, sidebar, body)

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

    start_up_modal <- function(){
        modalDialog(
            easyClose = F,
            shinyauthr::loginUI(id = "login"),
            footer = NULL)
    }
    showModal(start_up_modal())

    logout_init <- callModule(shinyauthr::logout, 
                              id = "logout", 
                              active = reactive(credentials()$user_auth))
    
    credentials <- callModule(shinyauthr::login, 
                              id = "login", 
                              data = user_base,
                              user_col = user,
                              pwd_col = password,
                              sodium_hashed = T,
                              log_out = reactive(logout_init()))
    observe({
        if(credentials()$user_auth){
        removeModal()}else{
        showModal(start_up_modal())
        }
    })

    output$SUPER_USER <- renderUser({
        req(credentials()$user_auth)
        dashboardUser(
            name = credentials()$info$name,
            subtitle =  credentials()$info$permissions, 
            src =  "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", 
            footer = 
                actionButton("btn", "this shows up"),
                # here it is not rendered:
                shinyauthr::logoutUI("logout")
                )
        })
}
shinyApp(ui = ui, server = server)

from shinyauthr.

jjfantini avatar jjfantini commented on June 5, 2024

How did you go about utilizing actionButton() in the server? @PaulC91 @roman-tremmel @olreim @ChuckHend @laresbernardo

from shinyauthr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.