@bagelink/auth 1.12.3 → 1.12.5
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.
- package/dist/index.cjs +2 -1183
- package/dist/index.d.ts +0 -9
- package/dist/index.mjs +3 -1184
- package/dist/routes.d.ts +0 -36
- package/package.json +1 -1
- package/src/index.ts +0 -13
- package/src/routes.ts +0 -96
- package/dist/Callback-BHqVaZZm.cjs +0 -4
- package/dist/Callback-C-XghN_z.js +0 -4
- package/dist/ForgotPasswordPage-BV9tyhHl.cjs +0 -4
- package/dist/ForgotPasswordPage-DvttMGb0.js +0 -4
- package/dist/LoginPage-hv1wc54S.cjs +0 -4
- package/dist/LoginPage-klj1NV4J.js +0 -4
- package/dist/ResetPasswordPage-COPrJmW8.cjs +0 -4
- package/dist/ResetPasswordPage-nvQ4uupb.js +0 -4
- package/dist/SignupPage-m36w9PLJ.cjs +0 -4
- package/dist/SignupPage-oUFYApYW.js +0 -4
- package/dist/components/auth/ForgotPasswordForm.vue.d.ts +0 -23
- package/dist/components/auth/LoginForm.vue.d.ts +0 -58
- package/dist/components/auth/ResetPasswordForm.vue.d.ts +0 -28
- package/dist/components/auth/SignupForm.vue.d.ts +0 -34
- package/dist/components/index.d.ts +0 -4
- package/dist/pages/Callback.vue.d.ts +0 -2
- package/dist/pages/ForgotPasswordPage.vue.d.ts +0 -13
- package/dist/pages/LoginPage.vue.d.ts +0 -38
- package/dist/pages/ResetPasswordPage.vue.d.ts +0 -13
- package/dist/pages/SignupPage.vue.d.ts +0 -16
- package/src/components/auth/ForgotPasswordForm.vue +0 -97
- package/src/components/auth/LoginForm.vue +0 -258
- package/src/components/auth/ResetPasswordForm.vue +0 -156
- package/src/components/auth/SignupForm.vue +0 -231
- package/src/components/index.ts +0 -5
- package/src/pages/Callback.vue +0 -196
- package/src/pages/ForgotPasswordPage.vue +0 -42
- package/src/pages/LoginPage.vue +0 -68
- package/src/pages/ResetPasswordPage.vue +0 -47
- package/src/pages/SignupPage.vue +0 -46
package/src/pages/Callback.vue
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { AuthenticationResponse, SSOProvider } from '@bagelink/auth'
|
|
3
|
-
import { useAuth } from '@bagelink/auth'
|
|
4
|
-
import { Btn, Card, Icon, Loading } from '@bagelink/vue'
|
|
5
|
-
import { computed, onMounted, ref } from 'vue'
|
|
6
|
-
import { useRoute, useRouter } from 'vue-router'
|
|
7
|
-
|
|
8
|
-
import { providers } from '../constants'
|
|
9
|
-
|
|
10
|
-
const isLoading = ref(true)
|
|
11
|
-
const error = ref<string | null>(null)
|
|
12
|
-
const success = ref(false)
|
|
13
|
-
const isLinking = ref(false)
|
|
14
|
-
const provider = ref<SSOProvider | null>(null)
|
|
15
|
-
const authResponse = ref<AuthenticationResponse | null>(null)
|
|
16
|
-
|
|
17
|
-
const { sso, user, accountInfo } = useAuth()
|
|
18
|
-
const route = useRoute()
|
|
19
|
-
const router = useRouter()
|
|
20
|
-
const timeout = 4000
|
|
21
|
-
// Get provider info for better UI
|
|
22
|
-
const providerInfo = computed(() => {
|
|
23
|
-
if (provider.value === null) return null
|
|
24
|
-
return providers[provider.value]
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
async function linkCallback() {
|
|
28
|
-
isLinking.value = true
|
|
29
|
-
const { redirect } = route.query
|
|
30
|
-
try {
|
|
31
|
-
await sso.handleLinkCallback()
|
|
32
|
-
success.value = true
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
const redirectPath = typeof redirect === 'string' ? redirect : '/'
|
|
35
|
-
router.push(redirectPath)
|
|
36
|
-
}, timeout)
|
|
37
|
-
} catch (err: unknown) {
|
|
38
|
-
const errorMessage = err instanceof Error ? err.message : 'Failed to link account'
|
|
39
|
-
error.value = errorMessage
|
|
40
|
-
} finally {
|
|
41
|
-
isLoading.value = false
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function handleCallback() {
|
|
46
|
-
const { state, redirect } = route.query
|
|
47
|
-
provider.value = sessionStorage.getItem(`oauth_provider:${state}`) as SSOProvider
|
|
48
|
-
console.log('[Callback] Query params:', { state, redirect })
|
|
49
|
-
console.log('[Callback] Full route query:', route.query)
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
const response = await sso.handleCallback()
|
|
53
|
-
if (response === null) {
|
|
54
|
-
error.value = `Failed to authenticate with ${providerInfo.value?.name ?? 'provider'}`
|
|
55
|
-
} else {
|
|
56
|
-
authResponse.value = response
|
|
57
|
-
success.value = true
|
|
58
|
-
console.log('[Callback] Login successful, redirect param:', redirect)
|
|
59
|
-
// Auto-redirect will handle navigation, but fallback to manual redirect
|
|
60
|
-
// if auto-redirect is disabled or router not connected
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
const redirectPath = typeof redirect === 'string' ? redirect : '/'
|
|
63
|
-
console.log('[Callback] Manual fallback redirecting to:', redirectPath)
|
|
64
|
-
router.push(redirectPath)
|
|
65
|
-
}, timeout)
|
|
66
|
-
}
|
|
67
|
-
} catch (err: unknown) {
|
|
68
|
-
const errorMessage = err instanceof Error ? err.message : 'Authentication failed'
|
|
69
|
-
error.value = errorMessage
|
|
70
|
-
} finally {
|
|
71
|
-
isLoading.value = false
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
onMounted(async () => {
|
|
76
|
-
if (user.value) {
|
|
77
|
-
await linkCallback()
|
|
78
|
-
} else {
|
|
79
|
-
await handleCallback()
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<template>
|
|
85
|
-
<div class="flex justify-content-center align-items-center vh-100 px-1">
|
|
86
|
-
<Card class="p-2 txt-center w450px shadow">
|
|
87
|
-
<!-- Loading State -->
|
|
88
|
-
<div v-if="isLoading" class="flex column align-items-center gap-1">
|
|
89
|
-
<Loading />
|
|
90
|
-
<div class="mt-1">
|
|
91
|
-
<h2 class="mb-05 pb-0 mt-0 txt24 m_txt20">
|
|
92
|
-
{{ isLinking ? 'Linking Account' : 'Authenticating' }}
|
|
93
|
-
</h2>
|
|
94
|
-
<p class="opacity-7 txt-14">
|
|
95
|
-
Please wait while we {{ isLinking ? 'link your' : 'complete the' }} {{ providerInfo?.name
|
|
96
|
-
|| 'OAuth' }} {{ isLinking ? 'account' : 'authentication' }}.
|
|
97
|
-
</p>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<!-- Success State -->
|
|
102
|
-
<div v-else-if="success && !error" class="flex column align-items-center gap-1">
|
|
103
|
-
<div class="flex justify-content-center align-items-center mb-1">
|
|
104
|
-
<div class="relative">
|
|
105
|
-
<Icon name="check_circle" size="5" class="txt-green line-height-1" />
|
|
106
|
-
<div
|
|
107
|
-
v-if="providerInfo"
|
|
108
|
-
class="absolute flex justify-content-center align-items-center bg-white rounded"
|
|
109
|
-
style="bottom: -8px; right: -8px; width: 40px; height: 40px; border: 3px solid white;"
|
|
110
|
-
>
|
|
111
|
-
<Icon :name="providerInfo.icon" size="1.5" :style="{ color: providerInfo.color }" />
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
<div>
|
|
117
|
-
<h2 class="mb-05 pb-0 mt-0 txt24 m_txt20">
|
|
118
|
-
{{ isLinking ? 'Account Linked!' : 'Welcome Back!' }}
|
|
119
|
-
</h2>
|
|
120
|
-
<p class="opacity-7 txt-14 mb-1">
|
|
121
|
-
{{ isLinking
|
|
122
|
-
? `Successfully linked your ${providerInfo?.name || 'account'}.`
|
|
123
|
-
: `You've successfully signed in with ${providerInfo?.name || 'your account'}.`
|
|
124
|
-
}}
|
|
125
|
-
</p>
|
|
126
|
-
|
|
127
|
-
<!-- Show user info if available -->
|
|
128
|
-
<div v-if="user || accountInfo" class="bg-gray-light rounded p-1 mt-1">
|
|
129
|
-
<div class="flex column gap-05">
|
|
130
|
-
<div v-if="user?.name" class="flex align-items-center gap-05 justify-content-center">
|
|
131
|
-
<Icon name="person" size="1.2" class="opacity-7" />
|
|
132
|
-
<span class="txt-14 bold">{{ user.name }}</span>
|
|
133
|
-
</div>
|
|
134
|
-
<div v-if="user?.email" class="flex align-items-center gap-05 justify-content-center">
|
|
135
|
-
<Icon name="email" size="1.2" class="opacity-7" />
|
|
136
|
-
<span class="txt-14 opacity-7">{{ user.email }}</span>
|
|
137
|
-
</div>
|
|
138
|
-
<div
|
|
139
|
-
v-if="accountInfo?.authentication_methods"
|
|
140
|
-
class="flex gap-05 justify-content-center mt-05"
|
|
141
|
-
>
|
|
142
|
-
<Icon
|
|
143
|
-
v-for="method in accountInfo.authentication_methods" :key="method.id"
|
|
144
|
-
:name="method.type === 'sso' ? (method.provider || 'link') : 'password'" size="1.2"
|
|
145
|
-
class="opacity-5"
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
</div>
|
|
149
|
-
</div>
|
|
150
|
-
|
|
151
|
-
<p class="txt-12 opacity-5 mt-1">
|
|
152
|
-
Redirecting you to home...
|
|
153
|
-
</p>
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
|
|
157
|
-
<!-- Error State -->
|
|
158
|
-
<div v-else-if="error" class="flex column align-items-center gap-1">
|
|
159
|
-
<Icon name="error" size="5" class="txt-red mb-1 line-height-1" />
|
|
160
|
-
<div>
|
|
161
|
-
<h2 class="mb-05 pb-0 mt-0 txt24 m_txt20">
|
|
162
|
-
Authentication Failed
|
|
163
|
-
</h2>
|
|
164
|
-
<p class="opacity-7 txt-14 mb-1">
|
|
165
|
-
{{ error }}
|
|
166
|
-
</p>
|
|
167
|
-
|
|
168
|
-
<div class="bg-red-light rounded p-1 mt-1 mb-1">
|
|
169
|
-
<p class="txt-12 opacity-7">
|
|
170
|
-
This could happen if:
|
|
171
|
-
</p>
|
|
172
|
-
<ul class="txt-12 opacity-7 txt-start mt-05" style="list-style: none; padding-left: 0;">
|
|
173
|
-
<li class="mb-025">
|
|
174
|
-
• The authorization was cancelled
|
|
175
|
-
</li>
|
|
176
|
-
<li class="mb-025">
|
|
177
|
-
• The state parameter was invalid
|
|
178
|
-
</li>
|
|
179
|
-
<li class="mb-025">
|
|
180
|
-
• The OAuth provider denied access
|
|
181
|
-
</li>
|
|
182
|
-
<li class="mb-025">
|
|
183
|
-
• Network connectivity issues
|
|
184
|
-
</li>
|
|
185
|
-
</ul>
|
|
186
|
-
</div>
|
|
187
|
-
|
|
188
|
-
<div class="flex gap-05 justify-content-center">
|
|
189
|
-
<Btn outline value="Try Again" to="/login" />
|
|
190
|
-
<Btn value="Go Home" to="/" />
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
</div>
|
|
194
|
-
</Card>
|
|
195
|
-
</div>
|
|
196
|
-
</template>
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ForgotPasswordTexts } from '../components/auth/ForgotPasswordForm.vue'
|
|
3
|
-
import { Card } from '@bagelink/vue'
|
|
4
|
-
import { useRouter } from 'vue-router'
|
|
5
|
-
import ForgotPasswordForm from '../components/auth/ForgotPasswordForm.vue'
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
/** Custom texts for the forgot password form */
|
|
9
|
-
texts?: Partial<ForgotPasswordTexts>
|
|
10
|
-
/** Card styling */
|
|
11
|
-
cardWidth?: string
|
|
12
|
-
cardShadow?: boolean
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
16
|
-
cardWidth: '450px',
|
|
17
|
-
cardShadow: true
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const router = useRouter()
|
|
21
|
-
|
|
22
|
-
function switchForm(form: string) {
|
|
23
|
-
if (form === 'login') {
|
|
24
|
-
router.push('/login')
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<template>
|
|
30
|
-
<div class="flex justify-content-center align-items-center min-vh-100 px-1 py-2">
|
|
31
|
-
<Card
|
|
32
|
-
:class="{ shadow: cardShadow }"
|
|
33
|
-
:style="{ width: cardWidth, maxWidth: '100%' }"
|
|
34
|
-
class="p-2"
|
|
35
|
-
>
|
|
36
|
-
<ForgotPasswordForm
|
|
37
|
-
:texts="texts"
|
|
38
|
-
@switch-form="switchForm"
|
|
39
|
-
/>
|
|
40
|
-
</Card>
|
|
41
|
-
</div>
|
|
42
|
-
</template>
|
package/src/pages/LoginPage.vue
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { LoginTexts } from '../components/auth/LoginForm.vue'
|
|
3
|
-
import { Card } from '@bagelink/vue'
|
|
4
|
-
import { useRouter } from 'vue-router'
|
|
5
|
-
import LoginForm from '../components/auth/LoginForm.vue'
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
/** Custom texts for the login form */
|
|
9
|
-
texts?: Partial<LoginTexts>
|
|
10
|
-
/** Show/hide specific SSO providers */
|
|
11
|
-
github?: boolean
|
|
12
|
-
google?: boolean
|
|
13
|
-
microsoft?: boolean
|
|
14
|
-
apple?: boolean
|
|
15
|
-
okta?: boolean
|
|
16
|
-
facebook?: boolean
|
|
17
|
-
/** SSO button styling */
|
|
18
|
-
ssoOutline?: boolean
|
|
19
|
-
ssoShowValue?: boolean
|
|
20
|
-
ssoBrandBackground?: boolean
|
|
21
|
-
/** Show/hide form elements */
|
|
22
|
-
showForgotPassword?: boolean
|
|
23
|
-
showSignupButton?: boolean
|
|
24
|
-
/** Card styling */
|
|
25
|
-
cardWidth?: string
|
|
26
|
-
cardShadow?: boolean
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
-
github: true,
|
|
31
|
-
google: true,
|
|
32
|
-
microsoft: true,
|
|
33
|
-
apple: true,
|
|
34
|
-
okta: true,
|
|
35
|
-
facebook: true,
|
|
36
|
-
ssoOutline: true,
|
|
37
|
-
ssoShowValue: true,
|
|
38
|
-
ssoBrandBackground: true,
|
|
39
|
-
showForgotPassword: true,
|
|
40
|
-
showSignupButton: true,
|
|
41
|
-
cardWidth: '450px',
|
|
42
|
-
cardShadow: true
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
const router = useRouter()
|
|
46
|
-
|
|
47
|
-
function switchForm(form: string) {
|
|
48
|
-
if (form === 'signup') {
|
|
49
|
-
router.push('/signup')
|
|
50
|
-
} else if (form === 'forgot-password') {
|
|
51
|
-
router.push('/forgot-password')
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<template>
|
|
57
|
-
<div class="flex justify-content-center align-items-center min-vh-100 px-1 py-2">
|
|
58
|
-
<Card :class="{ shadow: cardShadow }" :style="{ width: cardWidth, maxWidth: '100%' }" class="p-2">
|
|
59
|
-
<LoginForm
|
|
60
|
-
:texts="texts" :github="github" :google="google" :microsoft="microsoft"
|
|
61
|
-
:apple="apple" :okta="okta" :facebook="facebook" :sso-outline="ssoOutline"
|
|
62
|
-
:sso-show-value="ssoShowValue" :sso-brand-background="ssoBrandBackground"
|
|
63
|
-
:show-forgot-password="showForgotPassword" :show-signup-button="showSignupButton"
|
|
64
|
-
@switch-form="switchForm"
|
|
65
|
-
/>
|
|
66
|
-
</Card>
|
|
67
|
-
</div>
|
|
68
|
-
</template>
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ResetPasswordTexts } from '../components/auth/ResetPasswordForm.vue'
|
|
3
|
-
import { Card } from '@bagelink/vue'
|
|
4
|
-
import { computed } from 'vue'
|
|
5
|
-
import { useRouter, useRoute } from 'vue-router'
|
|
6
|
-
import ResetPasswordForm from '../components/auth/ResetPasswordForm.vue'
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
/** Custom texts for the reset password form */
|
|
10
|
-
texts?: Partial<ResetPasswordTexts>
|
|
11
|
-
/** Card styling */
|
|
12
|
-
cardWidth?: string
|
|
13
|
-
cardShadow?: boolean
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
17
|
-
cardWidth: '450px',
|
|
18
|
-
cardShadow: true
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
const router = useRouter()
|
|
22
|
-
const route = useRoute()
|
|
23
|
-
|
|
24
|
-
const token = computed(() => route.query.token as string)
|
|
25
|
-
|
|
26
|
-
function switchForm(form: string) {
|
|
27
|
-
if (form === 'login') {
|
|
28
|
-
router.push('/login')
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<template>
|
|
34
|
-
<div class="flex justify-content-center align-items-center min-vh-100 px-1 py-2">
|
|
35
|
-
<Card
|
|
36
|
-
:class="{ shadow: cardShadow }"
|
|
37
|
-
:style="{ width: cardWidth, maxWidth: '100%' }"
|
|
38
|
-
class="p-2"
|
|
39
|
-
>
|
|
40
|
-
<ResetPasswordForm
|
|
41
|
-
:texts="texts"
|
|
42
|
-
:token="token"
|
|
43
|
-
@switch-form="switchForm"
|
|
44
|
-
/>
|
|
45
|
-
</Card>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
package/src/pages/SignupPage.vue
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { SignupTexts } from '../components/auth/SignupForm.vue'
|
|
3
|
-
import { Card } from '@bagelink/vue'
|
|
4
|
-
import { useRouter } from 'vue-router'
|
|
5
|
-
import SignupForm from '../components/auth/SignupForm.vue'
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
/** Custom texts for the signup form */
|
|
9
|
-
texts?: Partial<SignupTexts>
|
|
10
|
-
/** Show name fields (first name, last name) */
|
|
11
|
-
showNames?: boolean
|
|
12
|
-
/** Card styling */
|
|
13
|
-
cardWidth?: string
|
|
14
|
-
cardShadow?: boolean
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
-
showNames: true,
|
|
19
|
-
cardWidth: '450px',
|
|
20
|
-
cardShadow: true
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
const router = useRouter()
|
|
24
|
-
|
|
25
|
-
function switchForm(form: string) {
|
|
26
|
-
if (form === 'login') {
|
|
27
|
-
router.push('/login')
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<template>
|
|
33
|
-
<div class="flex justify-content-center align-items-center min-vh-100 px-1 py-2">
|
|
34
|
-
<Card
|
|
35
|
-
:class="{ shadow: cardShadow }"
|
|
36
|
-
:style="{ width: cardWidth, maxWidth: '100%' }"
|
|
37
|
-
class="p-2"
|
|
38
|
-
>
|
|
39
|
-
<SignupForm
|
|
40
|
-
:texts="texts"
|
|
41
|
-
:show-names="showNames"
|
|
42
|
-
@switch-form="switchForm"
|
|
43
|
-
/>
|
|
44
|
-
</Card>
|
|
45
|
-
</div>
|
|
46
|
-
</template>
|