'R Shiny shinyalert does not function with reCAPTCHAv3
Creating a shiny site that has a shinyalert while checking that a user is real through CAPTCHAv3 results in the no shinyalert appearing. There are no errors, just nothing happends.
Here is a reproducible example:
library(shiny)
library(shinyWidgets)
library(shinyjs)
library(shinyalert)
library(shinygCAPTCHAv3)
ui <- fluidPage(
useShinyalert(),
shinyjs::useShinyjs(),
# Staging
GreCAPTCHAv3Ui("<your site key>", "testing", "responseReceived"),
actionBttn("submit", "Testing!", style = "unite", color = "success"),
)
server <- function(input, output, session) {
observeEvent(input$responseReceived, {
# Set Up CAPTCHA Response
result <- GreCAPTCHAv3Server("<your site key>", input$responseReceived)
#### FOR TESTING
# result <- c() #### FOR TESTING
# result$success <- TRUE #### FOR TESTING
if(result$success){
info(result)
observeEvent(input$submit, {
shinyalert("Works!", "Shiny Alerts Works!",
type = "success",
closeOnEsc = FALSE,
closeOnClickOutside = FALSE,
showConfirmButton = FALSE,
showCancelButton = FALSE,
timer = 1000)
})
}
})
}
shinyApp(ui, server)
You can see that the shinyalert works when you comment out the
result <- GreCAPTCHAv3Server("<your site key>", input$responseReceived)
and uncomment the
# result <- c() #### FOR TESTING
# result$success <- TRUE #### FOR TESTING
Any help is appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
