session-modal-hotfix
This commit is contained in:
parent
49f7d4efc1
commit
4b73ace2f0
|
@ -92,30 +92,34 @@ export const SessionProvider = (props: {
|
||||||
const authorizer = createMemo(() => new Authorizer(config()))
|
const authorizer = createMemo(() => new Authorizer(config()))
|
||||||
const [oauthState, setOauthState] = createSignal<string>()
|
const [oauthState, setOauthState] = createSignal<string>()
|
||||||
|
|
||||||
// handle callback's redirect_uri
|
// handle auth state callback
|
||||||
createEffect(() => {
|
createEffect(
|
||||||
// oauth
|
on(
|
||||||
const state = searchParams()?.state
|
() => searchParams()?.state,
|
||||||
if (state) {
|
(state) => {
|
||||||
setOauthState((_s) => state)
|
if (state) {
|
||||||
const scope = searchParams()?.scope
|
setOauthState((_s) => state)
|
||||||
? searchParams()?.scope?.toString().split(' ')
|
const scope = searchParams()?.scope
|
||||||
: ['openid', 'profile', 'email']
|
? searchParams()?.scope?.toString().split(' ')
|
||||||
if (scope) console.info(`[context.session] scope: ${scope}`)
|
: ['openid', 'profile', 'email']
|
||||||
const url = searchParams()?.redirect_uri || searchParams()?.redirectURL || window.location.href
|
if (scope) console.info(`[context.session] scope: ${scope}`)
|
||||||
setConfig((c: ConfigType) => ({ ...c, redirectURL: url.split('?')[0] }))
|
const url = searchParams()?.redirect_uri || searchParams()?.redirectURL || window.location.href
|
||||||
changeSearchParams({ mode: 'confirm-email', modal: 'auth' }, true)
|
setConfig((c: ConfigType) => ({ ...c, redirectURL: url.split('?')[0] }))
|
||||||
}
|
changeSearchParams({ mode: 'confirm-email', m: 'auth' }, true)
|
||||||
})
|
}
|
||||||
|
},
|
||||||
|
{ defer: true }
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
// handle email confirm
|
// handle token confirm
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
const token = searchParams()?.token
|
const token = searchParams()?.token
|
||||||
const access_token = searchParams()?.access_token
|
const access_token = searchParams()?.access_token
|
||||||
if (access_token)
|
if (access_token)
|
||||||
changeSearchParams({
|
changeSearchParams({
|
||||||
mode: 'confirm-email',
|
mode: 'confirm-email',
|
||||||
modal: 'auth',
|
m: 'auth',
|
||||||
access_token,
|
access_token,
|
||||||
})
|
})
|
||||||
else if (token) changeSearchParams({ mode: 'change-password', modal: 'auth', token })
|
else if (token) changeSearchParams({ mode: 'change-password', modal: 'auth', token })
|
||||||
|
|
Loading…
Reference in New Issue
Block a user