Skip to content

Commit

Permalink
move authentication code
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrue committed Apr 8, 2024
1 parent a9fe894 commit ae33372
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
33 changes: 12 additions & 21 deletions R/iSEEindex.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion R/observers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions R/outputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
})
Expand Down

0 comments on commit ae33372

Please sign in to comment.