Skip to content

Commit beebc4a

Browse files
committed
fix: req signout check pre-signout #75
1 parent 6154e98 commit beebc4a

File tree

3 files changed

+34
-30
lines changed

3 files changed

+34
-30
lines changed

R/class-auth.R

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ FirebaseAuth <- R6::R6Class(
108108
req_sign_out = function(){
109109
user <- private$get_signed_in_checked()
110110
private$.user_signed_in <- user
111+
112+
if(length(user$success))
113+
return(FALSE)
114+
111115
req(!user$success)
112116
},
113117
#' @details Set language code for auth provider
@@ -287,10 +291,10 @@ FirebaseAuth <- R6::R6Class(
287291

288292
}
289293

290-
now <- as.numeric(Sys.time() + private$.grace_period)
294+
now <- as.numeric(Sys.time() + private$.grace_period)
291295

292-
if(as.numeric(signature$exp) < now){
293-
cli_alert_danger("Signature expiry is in the past")
296+
if(as.numeric(signature$exp) < now){
297+
cli_alert_danger("Signature expiry is in the past")
294298
if(interactive){
295299
CHOICE <- menu(c("Yes", "No"), title="Do you still want to continue ?")
296300
if (CHOICE != TRUE){
@@ -303,8 +307,8 @@ FirebaseAuth <- R6::R6Class(
303307
}
304308
}
305309

306-
if(as.numeric(signature$iat) > now){
307-
cli_alert_danger("Signature expiry is in the future")
310+
if(as.numeric(signature$iat) > now){
311+
cli_alert_danger("Signature expiry is in the future")
308312
if(interactive){
309313
CHOICE <- menu(c("Yes", "No"), title="Do you still want to continue ?")
310314
if (CHOICE != TRUE){

R/class-core.R

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#'
99
#' @export
1010
Firebase <- R6::R6Class(
11-
"Firebase",
12-
public = list(
11+
"Firebase",
12+
public = list(
1313
session = NULL,
1414
#' @details Initialise Firebase
1515
#'
@@ -19,24 +19,24 @@ Firebase <- R6::R6Class(
1919
#' @param session A valid shiny session.
2020
#'
2121
#' @return Invisibly return the class.
22-
initialize = function(
22+
initialize = function(
2323
config_path = "firebase.rds",
24-
session = shiny::getDefaultReactiveDomain()
25-
){
24+
session = shiny::getDefaultReactiveDomain()
25+
){
2626

27-
conf <- read_config(config_path)
27+
conf <- read_config(config_path)
2828
self$session <- session
2929
private$.unique_id <- create_unique_id()
3030
private$.conf <- conf
3131
private$.project_id <- conf$projectId
3232

3333
# namespace
3434
private$.namespace(session)
35-
private$.send(
36-
"initialize-core",
35+
private$.send(
36+
"initialize-core",
3737
conf = conf
38-
)
39-
},
38+
)
39+
},
4040
#' @details Expose App
4141
#'
4242
#' Expose the `firebaseApp` object product of `initializeApp()` by
@@ -49,23 +49,23 @@ Firebase <- R6::R6Class(
4949
print = function(){
5050
cli_rule("Firebase")
5151
}
52-
),
53-
private = list(
52+
),
53+
private = list(
5454
send = function(func, msg = list()){
5555
func <- paste0("fireblaze-", func)
5656
msg$ns <- private$.ns
5757
self$session$sendCustomMessage(func, msg)
5858
},
5959
.send = function(func, ...){
6060
func <- paste0("fireblaze-", func)
61-
msg <- list(
62-
ns = private$.ns,
63-
...
64-
)
61+
msg <- list(
62+
ns = private$.ns,
63+
...
64+
)
6565
self$session$sendCustomMessage(func, msg)
6666
},
6767
.render_deps = function(deps){
68-
private$.send('render-dependencies', deps = deps)
68+
private$.send("render-dependencies", deps = deps)
6969
},
7070
get_input = function(name){
7171
name <- paste0("fireblaze_", name)
@@ -85,9 +85,9 @@ Firebase <- R6::R6Class(
8585
get_project_id = function() {
8686
return(invisible(private$.project_id))
8787
},
88-
.unique_id = NULL,
89-
.ns = "",
90-
.project_id = NULL,
91-
.conf = list()
92-
)
88+
.unique_id = NULL,
89+
.ns = "",
90+
.project_id = NULL,
91+
.conf = list()
92+
)
9393
)

R/class-social.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ FirebaseSocial <- R6::R6Class(
5252
#' @param language_code Sets the language to use for the UI.
5353
#' Supported languages are listed [here](https://github.com/firebase/firebaseui-web/blob/master/LANGUAGES.md).
5454
#' Set to `browser` to use the default browser language of the user.
55-
initialize = function(
55+
initialize = function(
5656
persistence = c("session", "local", "memory"),
5757
config_path = "firebase.rds",
5858
language_code = NULL,
5959
session = shiny::getDefaultReactiveDomain()
60-
){
60+
){
6161
super$initialize(
6262
persistence,
6363
config_path,
@@ -67,7 +67,7 @@ FirebaseSocial <- R6::R6Class(
6767
super$.render_deps(
6868
list(firebase_dep_social())
6969
)
70-
},
70+
},
7171
#' @details Define the scope to request from Google.
7272
#' @param scope Google scope.
7373
#' @return self

0 commit comments

Comments
 (0)