server.r
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad") |
# Define server logic required to summarize and view the selected dataset |
shinyServer(function(input, output) { |
source("www/Login.R", local = TRUE) |
if (USER$Logged == TRUE) { |
sliderInput("obs", "Number of observations:", |
min = 10000, max = 90000, |
value = 50000, step = 10000) |
output$distPlot <- renderPlot({ |
hist(dist, breaks = 100, main = paste("Your password:", input$passwd)) |
})
www/login.r
USER <- reactiveValues(Logged = Logged) |
passwdInput <- function(inputId, label) { |
tags$input(id = inputId, type="password", value="") |
output$uiLogin <- renderUI({ |
if (USER$Logged == FALSE) { |
textInput("userName", "User Name:"), |
passwdInput("passwd", "Pass word:"), |
actionButton("Login", "Log in") |
output$pass <- renderText({ |
if (USER$Logged == FALSE) { |
if (!is.null(input$Login)) { |
Username <- isolate(input$userName) |
Password <- isolate(input$passwd) |
Id.username <- which(PASSWORD$Brukernavn == Username) |
Id.password <- which(PASSWORD$Passord == Password) |
if (length(Id.username) > 0 & length(Id.password) > 0) { |
if (Id.username == Id.password) { |
"User name or password failed!" |
})
How do i add logout button on navbar menu after log in I referred the code from above link https://gist.github.com/withr/9001831
|
|