Password field using R Shiny framework

后端 未结 2 1818
北恋
北恋 2021-01-04 23:07

I am planning to make a log-in for my application. For that I need a password field. I am not aware if shiny is even used for this purpose but still is it p

2条回答
  •  庸人自扰
    2021-01-04 23:59

    Also, in the meantime there's a native

    passwordInput("passwd",label = "Enter password")
    

    password input in shiny. This feature is available in shiny 0.11.1. Here's your reproducible example:

    library(shiny)
    shinyApp(ui = fluidPage(
    
    tabPanel("Login",
           br(),
           tags$form(
             passwordInput("passwd",label = "Enter password"),
             submitButton("send passwd to shiny")
           ),
           textOutput("pwd")
    
     )
    ),
    server = function(input, output,session) {
    
    output$pwd <- renderText({
    paste0("Your PW is: ",input$passwd)
    })
    
    
    })
    

    Note, that the password is in the session then I am not so sure, how to erase the password from input$passwd after login was successful.

提交回复
热议问题