@rpcbase/client 0.96.0 → 0.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
|
|
3
|
+
const redirect_sign_in = (ctx) => {
|
|
4
|
+
console.log("REDIRECT SIGN IN NYI NATIVE")
|
|
5
|
+
console.log("CTX", ctx)
|
|
6
|
+
|
|
7
|
+
// const redirect_path = ctx.canonicalPath
|
|
8
|
+
// page.redirect(`/signin?redirect=${encodeURIComponent(redirect_path)}`)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default redirect_sign_in
|
package/auth/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* @flow */
|
|
2
|
-
import page from "page"
|
|
3
2
|
import debug from "debug"
|
|
4
3
|
import isHexadecimal from "validator/lib/isHexadecimal"
|
|
5
4
|
|
|
6
5
|
import {disconnect as rts_disconnect} from "../rts"
|
|
7
6
|
import post from "../helpers/post"
|
|
8
7
|
|
|
8
|
+
import redirect_sign_in from "./helpers/redirect_sign_in"
|
|
9
|
+
|
|
9
10
|
const LAST_TENANT_KEY = "rb.last_tenant_id"
|
|
10
11
|
const uid_storage_key = (tenant_id) => `rb.${tenant_id}.user_id`
|
|
11
12
|
|
|
@@ -31,6 +32,12 @@ const get_querystring_auth_id = () => {
|
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
const run_session_check = async() => {
|
|
35
|
+
// TODO: TMP: we're skipping the session check on mobile for now,
|
|
36
|
+
// this assumes having a token on mobile means we're authenticated
|
|
37
|
+
if (Platform.OS !== "web") {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
const auth_user_id = get_querystring_auth_id()
|
|
35
42
|
|
|
36
43
|
if (auth_user_id) {
|
|
@@ -66,15 +73,9 @@ const run_session_check = async() => {
|
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
// Force trigger run first session check (when we are not in a webworker)
|
|
70
|
-
if (typeof window !== "undefined") run_session_check()
|
|
71
76
|
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
const redirect_sign_in = (ctx) => {
|
|
75
|
-
const redirect_path = ctx.canonicalPath
|
|
76
|
-
page.redirect(`/signin?redirect=${encodeURIComponent(redirect_path)}`)
|
|
77
|
-
}
|
|
77
|
+
// Force trigger run first session check (when we are not in a webworker (or mobile))
|
|
78
|
+
if (typeof window !== "undefined") run_session_check()
|
|
78
79
|
|
|
79
80
|
|
|
80
81
|
export const session_restrict = (ctx, next) => {
|