diff --git a/packages/frontend-2/components/auth/RegisterPanel.vue b/packages/frontend-2/components/auth/RegisterPanel.vue
index eeb593a13..66499faa5 100644
--- a/packages/frontend-2/components/auth/RegisterPanel.vue
+++ b/packages/frontend-2/components/auth/RegisterPanel.vue
@@ -42,6 +42,7 @@
v-if="serverInfo && hasLocalStrategy"
:challenge="challenge"
:server-info="serverInfo"
+ :invite-email="inviteEmail"
/>
@@ -63,13 +64,30 @@ graphql(`
}
`)
+const serverInviteQuery = graphql(`
+ query RegisterPanelServerInvite($token: String!) {
+ serverInviteByToken(token: $token) {
+ id
+ email
+ }
+ }
+`)
+
const newsletterConsent = ref(false)
provide('newsletterconsent', newsletterConsent)
const { result } = useQuery(loginServerInfoQuery)
const { appId, challenge, inviteToken } = useLoginOrRegisterUtils()
+const { result: inviteMetadata } = useQuery(
+ serverInviteQuery,
+ () => ({ token: inviteToken.value || '' }),
+ {
+ enabled: computed(() => !!inviteToken.value?.length)
+ }
+)
+const inviteEmail = computed(() => inviteMetadata.value?.serverInviteByToken?.email)
const serverInfo = computed(() => result.value?.serverInfo)
const hasLocalStrategy = computed(() =>
(serverInfo.value?.authStrategies || []).some((s) => s.id === AuthStrategy.Local)
diff --git a/packages/frontend-2/components/auth/RegisterWithEmailBlock.vue b/packages/frontend-2/components/auth/RegisterWithEmailBlock.vue
index 757a6019c..126182828 100644
--- a/packages/frontend-2/components/auth/RegisterWithEmailBlock.vue
+++ b/packages/frontend-2/components/auth/RegisterWithEmailBlock.vue
@@ -15,6 +15,7 @@
auto-focus
/>
()
const { handleSubmit } = useForm()
const router = useRouter()
+const { signUpWithEmail, inviteToken } = useAuthManager()
+const { triggerNotification } = useGlobalToast()
const loading = ref(false)
const password = ref('')
+const email = ref('')
const emailRules = [isEmail]
const nameRules = [isRequired]
-const { signUpWithEmail, inviteToken } = useAuthManager()
-const { triggerNotification } = useGlobalToast()
-
const newsletterConsent = inject[>('newsletterconsent')
const pwdFocused = ref(false)
const { isSmallerOrEqualSm } = useIsSmallerOrEqualThanBreakpoint()
+const isEmailDisabled = computed(() => !!props.inviteEmail?.length || loading.value)
+
const finalLoginRoute = computed(() => {
const result = router.resolve({
path: loginRoute,
@@ -149,6 +153,16 @@ const onSubmit = handleSubmit(async (fullUser) => {
loading.value = false
}
})
+
+watch(
+ () => props.inviteEmail,
+ (inviteEmail) => {
+ if (inviteEmail) {
+ email.value = inviteEmail
+ }
+ },
+ { immediate: true }
+)
]