redirect signin
This commit is contained in:
@@ -18,7 +18,8 @@ const uiConfig = {
|
|||||||
firebase.auth.EmailAuthProvider.PROVIDER_ID,
|
firebase.auth.EmailAuthProvider.PROVIDER_ID,
|
||||||
firebase.auth.GoogleAuthProvider.PROVIDER_ID
|
firebase.auth.GoogleAuthProvider.PROVIDER_ID
|
||||||
],
|
],
|
||||||
signInFlow: 'popup',
|
// signInFlow: 'popup',
|
||||||
|
signInFlow: 'redirect',
|
||||||
callbacks: {
|
callbacks: {
|
||||||
signInSuccessWithAuthResult(authResult: any) {
|
signInSuccessWithAuthResult(authResult: any) {
|
||||||
// var user = authResult.user
|
// var user = authResult.user
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ const emit = defineEmits<{
|
|||||||
const searchActive = ref<boolean>(false)
|
const searchActive = ref<boolean>(false)
|
||||||
|
|
||||||
const authUI: any = inject('firebaseAuthUI')
|
const authUI: any = inject('firebaseAuthUI')
|
||||||
const authModalInitialStateOpen = ref<boolean>(authUI.isPendingRedirect())
|
const authPending = ref<boolean>(authUI.isPendingRedirect())
|
||||||
|
|
||||||
|
const handleSignIn = async (close: () => Promise<boolean>) => {
|
||||||
|
await close()
|
||||||
|
authPending.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="z-[500] flex h-[50px] bg-primary" :class="searchActive && 'search-active'">
|
<div class="z-[500] flex h-[50px] bg-primary" :class="searchActive && 'search-active'">
|
||||||
@@ -36,7 +41,7 @@ const authModalInitialStateOpen = ref<boolean>(authUI.isPendingRedirect())
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex h-full flex-grow flex-row items-center gap-2 pl-5 pr-3">
|
<div class="flex h-full flex-grow flex-row items-center gap-2 pl-5 pr-3">
|
||||||
<template v-if="!loading">
|
<template v-if="!loading || authPending">
|
||||||
<SearchBar @active="(active) => (searchActive = active)" />
|
<SearchBar @active="(active) => (searchActive = active)" />
|
||||||
<UIButton
|
<UIButton
|
||||||
size="sm"
|
size="sm"
|
||||||
@@ -46,7 +51,7 @@ const authModalInitialStateOpen = ref<boolean>(authUI.isPendingRedirect())
|
|||||||
>
|
>
|
||||||
<i class="fa-fw fa-solid fa-plus-circle scale-[115%]" />
|
<i class="fa-fw fa-solid fa-plus-circle scale-[115%]" />
|
||||||
</UIButton>
|
</UIButton>
|
||||||
<UIModal v-if="initialized && !user" :open="authModalInitialStateOpen">
|
<UIModal v-if="(initialized && !user) || authPending" :open="authPending">
|
||||||
<template #activator="{ open }">
|
<template #activator="{ open }">
|
||||||
<UIButton
|
<UIButton
|
||||||
size="sm"
|
size="sm"
|
||||||
@@ -57,9 +62,9 @@ const authModalInitialStateOpen = ref<boolean>(authUI.isPendingRedirect())
|
|||||||
Sign in
|
Sign in
|
||||||
</UIButton>
|
</UIButton>
|
||||||
</template>
|
</template>
|
||||||
<template #title>Sign in</template>
|
<template #title>{{ authPending ? 'Signing in...' : 'Sign in' }}</template>
|
||||||
<template #default="{ close }">
|
<template #default="{ close }">
|
||||||
<Auth @signedIn="close" />
|
<Auth @signedIn="handleSignIn(close)" :authenticating="authPending" />
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ close }">
|
<template #actions="{ close }">
|
||||||
<UIButton size="sm" @click="close">Close</UIButton>
|
<UIButton size="sm" @click="close">Close</UIButton>
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import { signOut as firebaseSignOut } from '@/composables/useFirebase'
|
|||||||
import { clearEncryptionKeys } from '@/composables/useEncryption'
|
import { clearEncryptionKeys } from '@/composables/useEncryption'
|
||||||
|
|
||||||
const signOut = async (close: () => Promise<boolean>) => {
|
const signOut = async (close: () => Promise<boolean>) => {
|
||||||
|
await close()
|
||||||
await firebaseSignOut()
|
await firebaseSignOut()
|
||||||
preferredNotesSource.value = null
|
preferredNotesSource.value = null
|
||||||
clearEncryptionKeys()
|
clearEncryptionKeys()
|
||||||
close()
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ const onLeave = (el: Element, done: () => void): void => {
|
|||||||
|
|
||||||
const styleClass = computed(() => {
|
const styleClass = computed(() => {
|
||||||
const sizeVariants = {
|
const sizeVariants = {
|
||||||
'sm': 'max-w-xs',
|
sm: 'max-w-xs',
|
||||||
'md': 'max-w-md',
|
md: 'max-w-md',
|
||||||
'lg': 'max-w-2xl'
|
lg: 'max-w-2xl'
|
||||||
}
|
}
|
||||||
const sizeClass = sizeVariants[props.size]
|
const sizeClass = sizeVariants[props.size]
|
||||||
return [sizeClass]
|
return [sizeClass]
|
||||||
@@ -67,7 +67,7 @@ defineExpose({ open, close })
|
|||||||
<Transition @enter="onEnter" @leave="onLeave" appear>
|
<Transition @enter="onEnter" @leave="onLeave" appear>
|
||||||
<div class="dui-modal bg-neutral-800 bg-opacity-60" v-if="show" ref="modal">
|
<div class="dui-modal bg-neutral-800 bg-opacity-60" v-if="show" ref="modal">
|
||||||
<div class="dui-modal-box" :class="styleClass" ref="modalBox">
|
<div class="dui-modal-box" :class="styleClass" ref="modalBox">
|
||||||
<h3 class="flex items-center text-xl font-bold mb-4" v-if="$slots.title">
|
<h3 class="mb-4 flex items-center text-xl font-bold" v-if="$slots.title">
|
||||||
<slot name="title" />
|
<slot name="title" />
|
||||||
</h3>
|
</h3>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user