title: If Statement in Shiny based on values in reactive
body: <p>I am building an authentication part in my app by comparing the code sent in email and the code users submit. I have tried adding if-statement by using either in reactive(),isolate(), renderTable(). I either get the value should be in the reactive part error, or the app does not respond at all. 
  Below is what I have in <strong>Server.R</strong>, the app does not respond at all with no error.</p>
  
  <pre><code>            shinyServer(function(input, output, session) {      
                myData &lt;- reactive({
                  req(input$Id)
                  #connect to the database, get the data, res
                  #send an email with random number, rnd
                  list(res,rnd)
                })
  
                output$tbTable &lt;- renderTable({req(input$Auth)
                    if (input$AuthCode==myData()$rnd) {
                  myData()$res
                }
                else{
                  as.data.frame(c("Authentication Failed"))
                }
                })
                output$downloadData &lt;- downloadHandler(
                  filename = function() {
                    paste(input$Id, " filname.xlsx", sep = "")
                  },
                  content = function(file) {
                    write.csv(myData(), file, row.names = FALSE)
                  }
                )#this part need to depend on the if-statement as well
              }
              )
  </code></pre>
  
  <p><strong>UI.R</strong></p>
  
  <pre><code>                ui &lt;- shinyUI(fluidPage(title = "aaa",
                  titlePanel("aaa"),
                  sidebarLayout(
                    sidebarPanel(
  
                      textInput("Id", "Enter Acct Name below"),
                      submitButton(text="Submit"),
                      tags$hr(),
                      numericInput("AuthCode",label="Authentication",value=""),
                      actionButton("Auth",label="Submit"),
                      tags$hr(),
                      tags$hr(),
                      downloadButton("downloadData", "Download Data")
                    ),
                    mainPanel(
                      tabsetPanel(
                        tabPanel("Data", tableOutput("tbTable"))
                      )) 
                  ),
              )
              )
  </code></pre>