lajh87 / rlogin

Authentication module for shiny apps
https://lajh87.github.io/rlogin/
Other
0 stars 0 forks source link

rlogin

Codecov test coverage

The goal of rlogin is to create authentication process for users to shiny applications.

Installation

You can install the development version of rlogin like so:

devtools::install_github("lajh87/rlogin")

Example

This is a basic example which shows you how to solve a common problem:

library(shiny)
library(rlogin)

ui <- fluidPage(
  loginUI("login"),
  uiOutput("logout")
)

pool <- connect_db("SQLite", setup = TRUE, testuser = TRUE)
onStop(function(){pool::poolClose(pool)})

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

  login <- callModule(
    module = loginServer,
    id = "login",
    db = pool
  )

  output$logout <- renderUI({
    if(login$password_verified){
      logoutUI("login")
    }
  })
}

shinyApp(ui, server)