@bagelink/auth 1.12.3 → 1.12.8
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/api.d.ts +54 -1
- package/dist/index.cjs +154 -1181
- package/dist/index.d.ts +0 -9
- package/dist/index.mjs +155 -1182
- package/dist/routes.d.ts +0 -36
- package/dist/types.d.ts +68 -1
- package/dist/useAuth.d.ts +17 -1
- package/package.json +1 -1
- package/src/api.ts +118 -0
- package/src/index.ts +0 -13
- package/src/routes.ts +0 -96
- package/src/types.ts +81 -1
- package/src/useAuth.ts +103 -0
- 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
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface ForgotPasswordTexts {
|
|
2
|
-
title?: string;
|
|
3
|
-
emailLabel?: string;
|
|
4
|
-
submitButton?: string;
|
|
5
|
-
backToLogin?: string;
|
|
6
|
-
emailSentTitle?: string;
|
|
7
|
-
emailSentMessage?: string;
|
|
8
|
-
}
|
|
9
|
-
interface Props {
|
|
10
|
-
emailSent?: boolean;
|
|
11
|
-
useHebrewDefaults?: boolean;
|
|
12
|
-
texts?: Partial<ForgotPasswordTexts>;
|
|
13
|
-
}
|
|
14
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
15
|
-
switchForm: (form: string) => any;
|
|
16
|
-
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
17
|
-
onSwitchForm?: ((form: string) => any) | undefined;
|
|
18
|
-
}>, {
|
|
19
|
-
emailSent: boolean;
|
|
20
|
-
useHebrewDefaults: boolean;
|
|
21
|
-
texts: Partial<ForgotPasswordTexts>;
|
|
22
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
-
export default _default;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export interface LoginTexts {
|
|
2
|
-
title?: string;
|
|
3
|
-
emailLabel?: string;
|
|
4
|
-
passwordLabel?: string;
|
|
5
|
-
forgotPassword?: string;
|
|
6
|
-
loginButton?: string;
|
|
7
|
-
signupButton?: string;
|
|
8
|
-
orText?: string;
|
|
9
|
-
githubButton?: string;
|
|
10
|
-
googleButton?: string;
|
|
11
|
-
microsoftButton?: string;
|
|
12
|
-
appleButton?: string;
|
|
13
|
-
oktaButton?: string;
|
|
14
|
-
facebookButton?: string;
|
|
15
|
-
}
|
|
16
|
-
interface Props {
|
|
17
|
-
hideRegularLogin?: boolean;
|
|
18
|
-
showForgotPassword?: boolean;
|
|
19
|
-
showSignupButton?: boolean;
|
|
20
|
-
github?: boolean;
|
|
21
|
-
google?: boolean;
|
|
22
|
-
microsoft?: boolean;
|
|
23
|
-
apple?: boolean;
|
|
24
|
-
okta?: boolean;
|
|
25
|
-
facebook?: boolean;
|
|
26
|
-
ssoOutline?: boolean;
|
|
27
|
-
ssoShowValue?: boolean;
|
|
28
|
-
ssoSize?: 'xs' | 's' | 'm' | 'l' | 'xl' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
|
|
29
|
-
ssoAlign?: boolean;
|
|
30
|
-
ssoBrandBackground?: boolean;
|
|
31
|
-
useHebrewDefaults?: boolean;
|
|
32
|
-
errorState?: 'normal' | 'email-required' | 'email-invalid' | 'password-required' | 'invalid-credentials' | 'server-error';
|
|
33
|
-
texts?: Partial<LoginTexts>;
|
|
34
|
-
}
|
|
35
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
36
|
-
switchForm: (form: string) => any;
|
|
37
|
-
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
38
|
-
onSwitchForm?: ((form: string) => any) | undefined;
|
|
39
|
-
}>, {
|
|
40
|
-
google: boolean;
|
|
41
|
-
microsoft: boolean;
|
|
42
|
-
github: boolean;
|
|
43
|
-
okta: boolean;
|
|
44
|
-
apple: boolean;
|
|
45
|
-
facebook: boolean;
|
|
46
|
-
useHebrewDefaults: boolean;
|
|
47
|
-
texts: Partial<LoginTexts>;
|
|
48
|
-
hideRegularLogin: boolean;
|
|
49
|
-
showForgotPassword: boolean;
|
|
50
|
-
showSignupButton: boolean;
|
|
51
|
-
ssoOutline: boolean;
|
|
52
|
-
ssoShowValue: boolean;
|
|
53
|
-
ssoSize: "xs" | "s" | "m" | "l" | "xl" | "extra-small" | "small" | "medium" | "large" | "extra-large";
|
|
54
|
-
ssoAlign: boolean;
|
|
55
|
-
ssoBrandBackground: boolean;
|
|
56
|
-
errorState: "normal" | "email-required" | "email-invalid" | "password-required" | "invalid-credentials" | "server-error";
|
|
57
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLFormElement>;
|
|
58
|
-
export default _default;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface ResetPasswordTexts {
|
|
2
|
-
title?: string;
|
|
3
|
-
invalidLinkTitle?: string;
|
|
4
|
-
invalidLinkMessage?: string;
|
|
5
|
-
newPasswordLabel?: string;
|
|
6
|
-
confirmPasswordLabel?: string;
|
|
7
|
-
submitButton?: string;
|
|
8
|
-
backToLogin?: string;
|
|
9
|
-
passwordMismatchError?: string;
|
|
10
|
-
invalidTokenError?: string;
|
|
11
|
-
successTitle?: string;
|
|
12
|
-
successMessage?: string;
|
|
13
|
-
goToLogin?: string;
|
|
14
|
-
}
|
|
15
|
-
interface Props {
|
|
16
|
-
token?: string;
|
|
17
|
-
showSuccess?: boolean;
|
|
18
|
-
useHebrewDefaults?: boolean;
|
|
19
|
-
texts?: Partial<ResetPasswordTexts>;
|
|
20
|
-
}
|
|
21
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
22
|
-
switchForm: (form: string) => any;
|
|
23
|
-
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
24
|
-
onSwitchForm?: ((form: string) => any) | undefined;
|
|
25
|
-
}>, {
|
|
26
|
-
useHebrewDefaults: boolean;
|
|
27
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
28
|
-
export default _default;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface SignupTexts {
|
|
2
|
-
title?: string;
|
|
3
|
-
firstNameLabel?: string;
|
|
4
|
-
lastNameLabel?: string;
|
|
5
|
-
emailLabel?: string;
|
|
6
|
-
passwordLabel?: string;
|
|
7
|
-
confirmPasswordLabel?: string;
|
|
8
|
-
signupButton?: string;
|
|
9
|
-
alreadyHaveAccount?: string;
|
|
10
|
-
emailRequiredError?: string;
|
|
11
|
-
emailInvalidError?: string;
|
|
12
|
-
passwordRequiredError?: string;
|
|
13
|
-
passwordTooShortError?: string;
|
|
14
|
-
passwordMismatchError?: string;
|
|
15
|
-
firstNameRequiredError?: string;
|
|
16
|
-
lastNameRequiredError?: string;
|
|
17
|
-
}
|
|
18
|
-
interface Props {
|
|
19
|
-
showNames?: boolean;
|
|
20
|
-
useHebrewDefaults?: boolean;
|
|
21
|
-
errorState?: 'normal' | 'email-required' | 'email-invalid' | 'password-short' | 'password-mismatch' | 'name-required' | 'server-error';
|
|
22
|
-
texts?: Partial<SignupTexts>;
|
|
23
|
-
}
|
|
24
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
25
|
-
switchForm: (form: string) => any;
|
|
26
|
-
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
27
|
-
onSwitchForm?: ((form: string) => any) | undefined;
|
|
28
|
-
}>, {
|
|
29
|
-
useHebrewDefaults: boolean;
|
|
30
|
-
texts: Partial<SignupTexts>;
|
|
31
|
-
errorState: "normal" | "email-required" | "email-invalid" | "password-short" | "password-mismatch" | "name-required" | "server-error";
|
|
32
|
-
showNames: boolean;
|
|
33
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLFormElement>;
|
|
34
|
-
export default _default;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { default as ForgotPasswordForm } from './auth/ForgotPasswordForm.vue';
|
|
2
|
-
export { default as LoginForm } from './auth/LoginForm.vue';
|
|
3
|
-
export { default as ResetPasswordForm } from './auth/ResetPasswordForm.vue';
|
|
4
|
-
export { default as SignupForm } from './auth/SignupForm.vue';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
-
export default _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ForgotPasswordTexts } from '../components/auth/ForgotPasswordForm.vue';
|
|
2
|
-
interface Props {
|
|
3
|
-
/** Custom texts for the forgot password form */
|
|
4
|
-
texts?: Partial<ForgotPasswordTexts>;
|
|
5
|
-
/** Card styling */
|
|
6
|
-
cardWidth?: string;
|
|
7
|
-
cardShadow?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
10
|
-
cardWidth: string;
|
|
11
|
-
cardShadow: boolean;
|
|
12
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
13
|
-
export default _default;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { LoginTexts } from '../components/auth/LoginForm.vue';
|
|
2
|
-
interface Props {
|
|
3
|
-
/** Custom texts for the login form */
|
|
4
|
-
texts?: Partial<LoginTexts>;
|
|
5
|
-
/** Show/hide specific SSO providers */
|
|
6
|
-
github?: boolean;
|
|
7
|
-
google?: boolean;
|
|
8
|
-
microsoft?: boolean;
|
|
9
|
-
apple?: boolean;
|
|
10
|
-
okta?: boolean;
|
|
11
|
-
facebook?: boolean;
|
|
12
|
-
/** SSO button styling */
|
|
13
|
-
ssoOutline?: boolean;
|
|
14
|
-
ssoShowValue?: boolean;
|
|
15
|
-
ssoBrandBackground?: boolean;
|
|
16
|
-
/** Show/hide form elements */
|
|
17
|
-
showForgotPassword?: boolean;
|
|
18
|
-
showSignupButton?: boolean;
|
|
19
|
-
/** Card styling */
|
|
20
|
-
cardWidth?: string;
|
|
21
|
-
cardShadow?: boolean;
|
|
22
|
-
}
|
|
23
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
24
|
-
google: boolean;
|
|
25
|
-
microsoft: boolean;
|
|
26
|
-
github: boolean;
|
|
27
|
-
okta: boolean;
|
|
28
|
-
apple: boolean;
|
|
29
|
-
facebook: boolean;
|
|
30
|
-
showForgotPassword: boolean;
|
|
31
|
-
showSignupButton: boolean;
|
|
32
|
-
ssoOutline: boolean;
|
|
33
|
-
ssoShowValue: boolean;
|
|
34
|
-
ssoBrandBackground: boolean;
|
|
35
|
-
cardWidth: string;
|
|
36
|
-
cardShadow: boolean;
|
|
37
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
38
|
-
export default _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ResetPasswordTexts } from '../components/auth/ResetPasswordForm.vue';
|
|
2
|
-
interface Props {
|
|
3
|
-
/** Custom texts for the reset password form */
|
|
4
|
-
texts?: Partial<ResetPasswordTexts>;
|
|
5
|
-
/** Card styling */
|
|
6
|
-
cardWidth?: string;
|
|
7
|
-
cardShadow?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
10
|
-
cardWidth: string;
|
|
11
|
-
cardShadow: boolean;
|
|
12
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
13
|
-
export default _default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SignupTexts } from '../components/auth/SignupForm.vue';
|
|
2
|
-
interface Props {
|
|
3
|
-
/** Custom texts for the signup form */
|
|
4
|
-
texts?: Partial<SignupTexts>;
|
|
5
|
-
/** Show name fields (first name, last name) */
|
|
6
|
-
showNames?: boolean;
|
|
7
|
-
/** Card styling */
|
|
8
|
-
cardWidth?: string;
|
|
9
|
-
cardShadow?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
12
|
-
showNames: boolean;
|
|
13
|
-
cardWidth: string;
|
|
14
|
-
cardShadow: boolean;
|
|
15
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
16
|
-
export default _default;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { useAuth } from '@bagelink/auth'
|
|
3
|
-
import { Btn, Icon, TextInput } from '@bagelink/vue'
|
|
4
|
-
import { computed, ref } from 'vue'
|
|
5
|
-
|
|
6
|
-
export interface ForgotPasswordTexts {
|
|
7
|
-
title?: string
|
|
8
|
-
emailLabel?: string
|
|
9
|
-
submitButton?: string
|
|
10
|
-
backToLogin?: string
|
|
11
|
-
emailSentTitle?: string
|
|
12
|
-
emailSentMessage?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface Props {
|
|
16
|
-
emailSent?: boolean
|
|
17
|
-
useHebrewDefaults?: boolean
|
|
18
|
-
texts?: Partial<ForgotPasswordTexts>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
22
|
-
emailSent: false,
|
|
23
|
-
useHebrewDefaults: false,
|
|
24
|
-
texts: () => ({})
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
defineEmits<{
|
|
28
|
-
switchForm: [form: string]
|
|
29
|
-
}>()
|
|
30
|
-
|
|
31
|
-
const { forgotPassword } = useAuth()
|
|
32
|
-
|
|
33
|
-
const email = ref<string>('')
|
|
34
|
-
const internalEmailSent = ref(false)
|
|
35
|
-
|
|
36
|
-
const showEmailSent = computed(() => props.emailSent || internalEmailSent.value)
|
|
37
|
-
|
|
38
|
-
// Text configuration with conditional defaults
|
|
39
|
-
const texts = computed(() => {
|
|
40
|
-
const hebrewDefaults = {
|
|
41
|
-
title: 'שכחתם סיסמה',
|
|
42
|
-
emailLabel: 'איימיל',
|
|
43
|
-
submitButton: 'שליחת איימיל איפוס',
|
|
44
|
-
backToLogin: 'חזרה להתחברות',
|
|
45
|
-
emailSentTitle: 'איימיל נשלח!',
|
|
46
|
-
emailSentMessage: 'יש לבדוק את תיבת הדואר שלכם לקישור איפוס הסיסמה'
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const englishDefaults = {
|
|
50
|
-
title: 'Forgot Password',
|
|
51
|
-
emailLabel: 'Email',
|
|
52
|
-
submitButton: 'Send Reset Email',
|
|
53
|
-
backToLogin: 'Back to Login',
|
|
54
|
-
emailSentTitle: 'Email Sent!',
|
|
55
|
-
emailSentMessage: 'Check your inbox for a password reset link'
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
title: props.texts?.title ?? defaults.title,
|
|
62
|
-
emailLabel: props.texts?.emailLabel ?? defaults.emailLabel,
|
|
63
|
-
submitButton: props.texts?.submitButton ?? defaults.submitButton,
|
|
64
|
-
backToLogin: props.texts?.backToLogin ?? defaults.backToLogin,
|
|
65
|
-
emailSentTitle: props.texts?.emailSentTitle ?? defaults.emailSentTitle,
|
|
66
|
-
emailSentMessage: props.texts?.emailSentMessage ?? defaults.emailSentMessage
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
const textDirection = computed(() => ({ 'auth-rtl': props.useHebrewDefaults }))
|
|
71
|
-
|
|
72
|
-
async function handleRecoverPassword() {
|
|
73
|
-
await forgotPassword(email.value)
|
|
74
|
-
internalEmailSent.value = true
|
|
75
|
-
}
|
|
76
|
-
</script>
|
|
77
|
-
|
|
78
|
-
<template>
|
|
79
|
-
<div v-if="showEmailSent" class="txt-center" :class="[textDirection]">
|
|
80
|
-
<Icon name="email" size="4" class="opacity-3 mb-1" />
|
|
81
|
-
<h1 class="txt20 bold mb-1">
|
|
82
|
-
{{ texts.emailSentTitle }}
|
|
83
|
-
</h1>
|
|
84
|
-
<p class="txt-center opacity-7">
|
|
85
|
-
{{ texts.emailSentMessage }}
|
|
86
|
-
</p>
|
|
87
|
-
<Btn thin flat class="txt-12 mt-2 underline" :value="texts.backToLogin" @click="$emit('switchForm', 'login')" />
|
|
88
|
-
</div>
|
|
89
|
-
<form v-else :class="textDirection" @submit.prevent="handleRecoverPassword">
|
|
90
|
-
<h1 class="txt20 bold txt-center mb-1">
|
|
91
|
-
{{ texts.title }}
|
|
92
|
-
</h1>
|
|
93
|
-
<TextInput v-model="email" :label="texts.emailLabel" autocomplete="email" type="email" />
|
|
94
|
-
<Btn type="submit" class="w-100 mt-05" :value="texts.submitButton" />
|
|
95
|
-
<Btn thin flat class="txt-12 mt-075 underline block" :value="texts.backToLogin" @click="$emit('switchForm', 'login')" />
|
|
96
|
-
</form>
|
|
97
|
-
</template>
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { useAuth } from '@bagelink/auth'
|
|
3
|
-
import { Btn, PasswordInput, TextInput } from '@bagelink/vue'
|
|
4
|
-
import { computed, ref } from 'vue'
|
|
5
|
-
|
|
6
|
-
export interface LoginTexts {
|
|
7
|
-
title?: string
|
|
8
|
-
emailLabel?: string
|
|
9
|
-
passwordLabel?: string
|
|
10
|
-
forgotPassword?: string
|
|
11
|
-
loginButton?: string
|
|
12
|
-
signupButton?: string
|
|
13
|
-
orText?: string
|
|
14
|
-
githubButton?: string
|
|
15
|
-
googleButton?: string
|
|
16
|
-
microsoftButton?: string
|
|
17
|
-
appleButton?: string
|
|
18
|
-
oktaButton?: string
|
|
19
|
-
facebookButton?: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface Props {
|
|
23
|
-
hideRegularLogin?: boolean
|
|
24
|
-
showForgotPassword?: boolean
|
|
25
|
-
showSignupButton?: boolean
|
|
26
|
-
github?: boolean
|
|
27
|
-
google?: boolean
|
|
28
|
-
microsoft?: boolean
|
|
29
|
-
apple?: boolean
|
|
30
|
-
okta?: boolean
|
|
31
|
-
facebook?: boolean
|
|
32
|
-
ssoOutline?: boolean
|
|
33
|
-
ssoShowValue?: boolean
|
|
34
|
-
ssoSize?: 'xs' | 's' | 'm' | 'l' | 'xl' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large'
|
|
35
|
-
ssoAlign?: boolean
|
|
36
|
-
ssoBrandBackground?: boolean
|
|
37
|
-
useHebrewDefaults?: boolean
|
|
38
|
-
errorState?: 'normal' | 'email-required' | 'email-invalid' | 'password-required' | 'invalid-credentials' | 'server-error'
|
|
39
|
-
texts?: Partial<LoginTexts>
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
43
|
-
hideRegularLogin: false,
|
|
44
|
-
showForgotPassword: true,
|
|
45
|
-
showSignupButton: true,
|
|
46
|
-
github: false,
|
|
47
|
-
google: false,
|
|
48
|
-
microsoft: false,
|
|
49
|
-
apple: false,
|
|
50
|
-
okta: false,
|
|
51
|
-
facebook: false,
|
|
52
|
-
ssoOutline: true,
|
|
53
|
-
ssoShowValue: true,
|
|
54
|
-
ssoSize: undefined,
|
|
55
|
-
ssoAlign: false,
|
|
56
|
-
ssoBrandBackground: true,
|
|
57
|
-
useHebrewDefaults: false,
|
|
58
|
-
errorState: 'normal',
|
|
59
|
-
texts: () => ({})
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
defineEmits<{
|
|
63
|
-
switchForm: [form: string]
|
|
64
|
-
}>()
|
|
65
|
-
|
|
66
|
-
const { login, sso } = useAuth()
|
|
67
|
-
const form = ref({
|
|
68
|
-
email: '',
|
|
69
|
-
password: '',
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
const internalError = ref<string>('')
|
|
73
|
-
|
|
74
|
-
// Text configuration with conditional defaults
|
|
75
|
-
const texts = computed(() => {
|
|
76
|
-
const hebrewDefaults = {
|
|
77
|
-
title: 'התחברות',
|
|
78
|
-
emailLabel: 'אימייל',
|
|
79
|
-
passwordLabel: 'סיסמה',
|
|
80
|
-
forgotPassword: 'שכחתם סיסמה?',
|
|
81
|
-
loginButton: 'התחברות',
|
|
82
|
-
signupButton: 'יצירת חשבון',
|
|
83
|
-
orText: 'או',
|
|
84
|
-
githubButton: 'התחברות עם GitHub',
|
|
85
|
-
googleButton: 'התחברות עם Google',
|
|
86
|
-
microsoftButton: 'התחברות עם Microsoft',
|
|
87
|
-
appleButton: 'התחברות עם Apple',
|
|
88
|
-
oktaButton: 'התחברות עם Okta',
|
|
89
|
-
facebookButton: 'התחברות עם Facebook'
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const englishDefaults = {
|
|
93
|
-
title: 'Login',
|
|
94
|
-
emailLabel: 'Email',
|
|
95
|
-
passwordLabel: 'Password',
|
|
96
|
-
forgotPassword: 'Forgot Password',
|
|
97
|
-
loginButton: 'Login',
|
|
98
|
-
signupButton: 'Create Account',
|
|
99
|
-
orText: 'or',
|
|
100
|
-
githubButton: 'Continue with GitHub',
|
|
101
|
-
googleButton: 'Continue with Google',
|
|
102
|
-
microsoftButton: 'Continue with Microsoft',
|
|
103
|
-
appleButton: 'Continue with Apple',
|
|
104
|
-
oktaButton: 'Continue with Okta',
|
|
105
|
-
facebookButton: 'Continue with Facebook'
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const defaults = props.useHebrewDefaults ? hebrewDefaults : englishDefaults
|
|
109
|
-
|
|
110
|
-
return {
|
|
111
|
-
title: props.texts?.title ?? defaults.title,
|
|
112
|
-
emailLabel: props.texts?.emailLabel ?? defaults.emailLabel,
|
|
113
|
-
passwordLabel: props.texts?.passwordLabel ?? defaults.passwordLabel,
|
|
114
|
-
forgotPassword: props.texts?.forgotPassword ?? defaults.forgotPassword,
|
|
115
|
-
loginButton: props.texts?.loginButton ?? defaults.loginButton,
|
|
116
|
-
signupButton: props.texts?.signupButton ?? defaults.signupButton,
|
|
117
|
-
orText: props.texts?.orText ?? defaults.orText,
|
|
118
|
-
githubButton: props.texts?.githubButton ?? defaults.githubButton,
|
|
119
|
-
googleButton: props.texts?.googleButton ?? defaults.googleButton,
|
|
120
|
-
microsoftButton: props.texts?.microsoftButton ?? defaults.microsoftButton,
|
|
121
|
-
appleButton: props.texts?.appleButton ?? defaults.appleButton,
|
|
122
|
-
oktaButton: props.texts?.oktaButton ?? defaults.oktaButton,
|
|
123
|
-
facebookButton: props.texts?.facebookButton ?? defaults.facebookButton
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
const showAnySso = computed(() => props.github || props.google || props.microsoft
|
|
128
|
-
|| props.apple || props.okta || props.facebook
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
const textDirection = computed(() => ({ 'auth-rtl': props.useHebrewDefaults }))
|
|
132
|
-
|
|
133
|
-
const error = computed(() => getDevError() || internalError.value)
|
|
134
|
-
|
|
135
|
-
function getDevError() {
|
|
136
|
-
switch (props.errorState) {
|
|
137
|
-
case 'email-required': return props.useHebrewDefaults ? 'איימיל נדרש' : 'Email is required'
|
|
138
|
-
case 'email-invalid': return props.useHebrewDefaults ? 'יש להזין כתובת איימיל תקינה' : 'Please enter a valid email address'
|
|
139
|
-
case 'password-required': return props.useHebrewDefaults ? 'סיסמה נדרשת' : 'Password is required'
|
|
140
|
-
case 'invalid-credentials': return props.useHebrewDefaults ? 'איימיל או סיסמה לא נכונים' : 'Invalid email or password'
|
|
141
|
-
case 'server-error': return props.useHebrewDefaults ? 'ההתחברות נכשלה. אנא נסה שוב.' : 'Login failed. Please try again.'
|
|
142
|
-
default: return null
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
async function handleLogin() {
|
|
147
|
-
// Clear any previous internal errors
|
|
148
|
-
internalError.value = ''
|
|
149
|
-
|
|
150
|
-
// Development error states don't need actual form submission
|
|
151
|
-
if (props.errorState !== 'normal') {
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const { message } = await login(form.value)
|
|
156
|
-
internalError.value = message as string
|
|
157
|
-
}
|
|
158
|
-
</script>
|
|
159
|
-
|
|
160
|
-
<template>
|
|
161
|
-
<form :class="textDirection" @submit.prevent="handleLogin">
|
|
162
|
-
<h1 class="txt20 bold txt-center mb-1">
|
|
163
|
-
{{ texts.title }}
|
|
164
|
-
</h1>
|
|
165
|
-
|
|
166
|
-
<!-- Regular Login Form - Hidden when hideRegularLogin is true -->
|
|
167
|
-
<template v-if="!props.hideRegularLogin">
|
|
168
|
-
<TextInput v-model="form.email" type="email" :label="texts.emailLabel" autocomplete="email" />
|
|
169
|
-
<PasswordInput v-model="form.password" :label="texts.passwordLabel" />
|
|
170
|
-
|
|
171
|
-
<Btn
|
|
172
|
-
v-if="props.showForgotPassword" thin flat class="txt-12 mt-075 underline block"
|
|
173
|
-
:value="texts.forgotPassword" @click="$emit('switchForm', 'forgot-password')"
|
|
174
|
-
/>
|
|
175
|
-
<Btn type="submit" class="w-100 mt-1" :value="texts.loginButton" />
|
|
176
|
-
<Btn
|
|
177
|
-
v-if="props.showSignupButton" outline color="primary" class="w-100 mt-05" :value="texts.signupButton"
|
|
178
|
-
@click="$emit('switchForm', 'signup')"
|
|
179
|
-
/>
|
|
180
|
-
</template>
|
|
181
|
-
|
|
182
|
-
<!-- SSO Section -->
|
|
183
|
-
<div v-if="showAnySso">
|
|
184
|
-
<div v-if="!props.hideRegularLogin" class="flex gap-1 opacity-6">
|
|
185
|
-
<div class="line" />
|
|
186
|
-
<p class="txt-center my-05">
|
|
187
|
-
{{ texts.orText }}
|
|
188
|
-
</p>
|
|
189
|
-
<div class="line" />
|
|
190
|
-
</div>
|
|
191
|
-
|
|
192
|
-
<div
|
|
193
|
-
class="gap-05"
|
|
194
|
-
:class="{ 'grid grid-wrap-1': props.ssoShowValue, 'flex justify-content-center gap-05 flex-wrap': !props.ssoShowValue }"
|
|
195
|
-
>
|
|
196
|
-
<Btn
|
|
197
|
-
v-if="props.github" v-tooltip="!props.ssoShowValue ? texts.githubButton : undefined"
|
|
198
|
-
:outline="props.ssoOutline" :full-width="props.ssoAlign"
|
|
199
|
-
:align-txt="props.ssoAlign ? 'start' : undefined"
|
|
200
|
-
:style="props.ssoOutline ? 'color: #24292F;' : `color: #FFFFFF; ${props.ssoBrandBackground ? 'background: #24292F;' : ''}`"
|
|
201
|
-
icon="github" :class="{ 'px-075': props.ssoAlign ? 'px-075' : '' }"
|
|
202
|
-
:value="props.ssoShowValue ? texts.githubButton : undefined" :size="props.ssoSize"
|
|
203
|
-
@click="sso.github.redirect()"
|
|
204
|
-
/>
|
|
205
|
-
<Btn
|
|
206
|
-
v-if="props.google" v-tooltip="!props.ssoShowValue ? texts.googleButton : undefined"
|
|
207
|
-
:outline="props.ssoOutline" :full-width="props.ssoAlign"
|
|
208
|
-
:align-txt="props.ssoAlign ? 'start' : undefined"
|
|
209
|
-
:style="props.ssoOutline ? 'color: #DB4437;' : `color: #FFFFFF; ${props.ssoBrandBackground ? 'background: #DB4437;' : ''}`"
|
|
210
|
-
icon="google" :class="{ 'px-075': props.ssoAlign ? 'px-075' : '' }"
|
|
211
|
-
:value="props.ssoShowValue ? texts.googleButton : undefined" :size="props.ssoSize"
|
|
212
|
-
@click="sso.google.redirect()"
|
|
213
|
-
/>
|
|
214
|
-
<Btn
|
|
215
|
-
v-if="props.microsoft" v-tooltip="!props.ssoShowValue ? texts.microsoftButton : undefined"
|
|
216
|
-
:outline="props.ssoOutline" :full-width="props.ssoAlign"
|
|
217
|
-
:align-txt="props.ssoAlign ? 'start' : undefined"
|
|
218
|
-
:style="props.ssoOutline ? 'color: #2F2FEE;' : `color: #FFFFFF; ${props.ssoBrandBackground ? 'background: #2F2FEE;' : ''}`"
|
|
219
|
-
icon="microsoft" :class="{ 'px-075': props.ssoAlign ? 'px-075' : '' }"
|
|
220
|
-
:value="props.ssoShowValue ? texts.microsoftButton : undefined" :size="props.ssoSize"
|
|
221
|
-
@click="sso.microsoft.redirect()"
|
|
222
|
-
/>
|
|
223
|
-
<Btn
|
|
224
|
-
v-if="props.apple" v-tooltip="!props.ssoShowValue ? texts.appleButton : undefined"
|
|
225
|
-
:outline="props.ssoOutline" :full-width="props.ssoAlign"
|
|
226
|
-
:align-txt="props.ssoAlign ? 'start' : undefined"
|
|
227
|
-
:style="props.ssoOutline ? 'color: #000000;' : `color: #FFFFFF; ${props.ssoBrandBackground ? 'background: #000000;' : ''}`"
|
|
228
|
-
icon="apple" :class="{ 'px-075': props.ssoAlign ? 'px-075' : '' }"
|
|
229
|
-
:value="props.ssoShowValue ? texts.appleButton : undefined" :size="props.ssoSize"
|
|
230
|
-
@click="sso.apple.redirect()"
|
|
231
|
-
/>
|
|
232
|
-
<Btn
|
|
233
|
-
v-if="props.okta" v-tooltip="!props.ssoShowValue ? texts.oktaButton : undefined"
|
|
234
|
-
:outline="props.ssoOutline" :full-width="props.ssoAlign"
|
|
235
|
-
:align-txt="props.ssoAlign ? 'start' : undefined"
|
|
236
|
-
:style="props.ssoOutline ? 'color: #FFB600;' : `color: #FFFFFF; ${props.ssoBrandBackground ? 'background: #FFB600;' : ''}`"
|
|
237
|
-
icon="sun" :class="{ 'px-075': props.ssoAlign ? 'px-075' : '' }"
|
|
238
|
-
:value="props.ssoShowValue ? texts.oktaButton : undefined" :size="props.ssoSize"
|
|
239
|
-
@click="sso.okta.redirect()"
|
|
240
|
-
/>
|
|
241
|
-
<Btn
|
|
242
|
-
v-if="props.facebook" v-tooltip="!props.ssoShowValue ? texts.facebookButton : undefined"
|
|
243
|
-
:outline="props.ssoOutline" :full-width="props.ssoAlign"
|
|
244
|
-
:align-txt="props.ssoAlign ? 'start' : undefined"
|
|
245
|
-
:style="props.ssoOutline ? 'color: #1877F3;' : `color: #FFFFFF; ${props.ssoBrandBackground ? 'background: #1877F3;' : ''}`"
|
|
246
|
-
icon="facebook" :class="{ 'px-075': props.ssoAlign ? 'px-075' : '' }"
|
|
247
|
-
:value="props.ssoShowValue ? texts.facebookButton : undefined" :size="props.ssoSize"
|
|
248
|
-
@click="sso.facebook.redirect()"
|
|
249
|
-
/>
|
|
250
|
-
</div>
|
|
251
|
-
<div class="h-20px pt-075">
|
|
252
|
-
<p v-if="error" class="txt-center color-red txt-12">
|
|
253
|
-
{{ error }}
|
|
254
|
-
</p>
|
|
255
|
-
</div>
|
|
256
|
-
</div>
|
|
257
|
-
</form>
|
|
258
|
-
</template>
|