-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathmodule-pwd.R
47 lines (38 loc) · 911 Bytes
/
module-pwd.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
if (interactive()) {
library(shiny)
library(shinymanager)
ui <- fluidPage(
tags$h2("Change password module"),
actionButton(
inputId = "ask", label = "Ask to change password"
),
verbatimTextOutput(outputId = "res_pwd")
)
server <- function(input, output, session) {
observeEvent(input$ask, {
insertUI(
selector = "body",
ui = tags$div(
id = "module-pwd",
pwd_ui(id = "pwd")
)
)
})
output$res_pwd <- renderPrint({
reactiveValuesToList(pwd_out)
})
pwd_out <- callModule(
module = pwd_server,
id = "pwd",
user = reactiveValues(user = "me"),
update_pwd = function(user, pwd) {
# store the password somewhere
list(result = TRUE)
}
)
observeEvent(pwd_out$relog, {
removeUI(selector = "#module-pwd")
})
}
shinyApp(ui, server)
}