From ae333727a122d891b77f9eab18e35d2f85c51ab6 Mon Sep 17 00:00:00 2001 From: Kevin Rue-Albrecht Date: Mon, 8 Apr 2024 14:42:59 +0100 Subject: [PATCH] move authentication code --- R/iSEEindex.R | 33 ++++++++++++--------------------- R/observers.R | 6 +++++- R/outputs.R | 4 ++-- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/R/iSEEindex.R b/R/iSEEindex.R index 2e95039..e131394 100644 --- a/R/iSEEindex.R +++ b/R/iSEEindex.R @@ -77,27 +77,18 @@ iSEElogin <- function(app.title = NULL) { # nocov start initial <- NULL # TODO tour <- NULL # TODO - withProgress(message = sprintf("Logging in ..."), - value = 0, max = 3, { - incProgress(1, detail = "Verifying credentials") - Sys.sleep(2) - if (!.authenticate(username, password)) { - showNotification("Login failed.", type="error") - } else { - incProgress(1, detail = "Loading data set") - se2 <- SummarizedExperiment() # TODO: load desired data set (or another landing page like iSEEindex) - incProgress(1, detail = "Launching iSEE app") - FUN(SE=se2, INITIAL=initial, TOUR=tour) - shinyjs::enable(iSEE:::.generalOrganizePanels) # organize panels - shinyjs::enable(iSEE:::.generalLinkGraph) # link graph - shinyjs::enable(iSEE:::.generalExportOutput) # export content - shinyjs::enable(iSEE:::.generalCodeTracker) # tracked code - shinyjs::enable(iSEE:::.generalPanelSettings) # panel settings - shinyjs::enable(iSEE:::.generalVignetteOpen) # open vignette - shinyjs::enable(iSEE:::.generalSessionInfo) # session info - shinyjs::enable(iSEE:::.generalCitationInfo) # citation info - } - }, session = session) + + se2 <- SummarizedExperiment() # TODO: load desired data set (or another landing page like iSEEindex) + incProgress(1, detail = "Launching iSEE app") + FUN(SE=se2, INITIAL=initial, TOUR=tour) + shinyjs::enable(iSEE:::.generalOrganizePanels) # organize panels + shinyjs::enable(iSEE:::.generalLinkGraph) # link graph + shinyjs::enable(iSEE:::.generalExportOutput) # export content + shinyjs::enable(iSEE:::.generalCodeTracker) # tracked code + shinyjs::enable(iSEE:::.generalPanelSettings) # panel settings + shinyjs::enable(iSEE:::.generalVignetteOpen) # open vignette + shinyjs::enable(iSEE:::.generalSessionInfo) # session info + shinyjs::enable(iSEE:::.generalCitationInfo) # citation info invisible(NULL) # nocov end diff --git a/R/observers.R b/R/observers.R index 427dc04..09135c5 100644 --- a/R/observers.R +++ b/R/observers.R @@ -37,7 +37,11 @@ observeEvent(input[[.ui_login_submit]], { username <- input[[.ui_login_username]] password <- input[[.ui_login_password]] - .launch_isee(FUN, session, pObjects, username, password) + if (.authenticate(username, password)) { + .launch_isee(FUN, session, pObjects, username, password) + } else { + showNotification("Login failed.", type="error") + } }, ignoreNULL=TRUE, ignoreInit=TRUE) # nocov end diff --git a/R/outputs.R b/R/outputs.R index 4b8cea4..b4cf395 100644 --- a/R/outputs.R +++ b/R/outputs.R @@ -16,8 +16,8 @@ # nocov start output[[.ui_form_overview]] <- renderUI({ tagList( - textInput(inputId = .ui_login_username, label = "Username", placeholder = "Required"), - textInput(inputId = .ui_login_password, label = "Password", placeholder = "Required"), + textInput(inputId = .ui_login_username, label = "Username", value = "testuser", placeholder = "Required"), + textInput(inputId = .ui_login_password, label = "Password", value = "abcd1234", placeholder = "Required"), actionButton(inputId = .ui_login_submit, label = "Submit") ) })