Skip to content

User login and admin panel for shiny apps (Semantic UI)

Notifications You must be signed in to change notification settings

systats/shinyuser

Repository files navigation

shinyuser

This is a demonstration of how to implement user authentication directly in a shiny app. The core idea is to provide a simple, secure and modularized solution.

Features:

  1. User’s credentials are saved wherever you want.
  2. Clean landing page that overlays any arbitrary layout
  3. Basic security features
    • delayed login trialing (5 sec)
    • bcrypt for password encrypton
  4. Build with shiny.semantic for clean design patterns
  5. Tested with shinyapps.io

Minimal example of shinyuser

library(tidyverse)
library(shiny)
library(shinyjs)
library(shiny.semantic)
library(semantic.dashboard)
library(shinyuser)
library(openssl)
library(bcrypt)

ui <- function(){
  dashboardPage(
    dashboardHeader(
      inverted = T,
      login_ui("user"),
      div(class = "ui circular icon button action-button", id = "user-logout", 
        icon("power off")
      )
    ),
    dashboardSidebar(
      side = "left", size = "", inverted = T,
      sidebarMenu(
        div(class = "item",
          h4(class = "ui inverted header", "Something")
        )
      )
    ),
    dashboardBody(
      div(class = "sixteen wide column",
        "Something great content"
      )
    )
  )
}

server <- function(input, output) {
  
  users <- reactive({ 
    dplyr::tibble(name = "admin", pw = bcrypt::hashpw("test"))
  })
  
  user <- callModule(login_server, "user", users)

  observeEvent(user(), {
    observe(print(user()))
  })
}

shinyApp(ui, server)

About

User login and admin panel for shiny apps (Semantic UI)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published