feat(auth): social-first register screen

Emphasize Google/GitHub on the register page and hide the email form behind a
'Sign up with email' toggle that reveals it (shown directly when no social
providers are configured). Even spacing across all three buttons, an optional
hideDivider prop on SocialLogin, and a stronger value-led headline/subtext.
This commit is contained in:
Paulo Castellano 2026-06-22 12:31:53 -03:00
parent 09d4e9d6b1
commit b628f30f1b
5 changed files with 133 additions and 84 deletions

View file

@ -52,6 +52,7 @@
],
'or_continue_with' => 'Or continue with',
'or_continue_with_email' => 'Or continue with email',
'google_login' => 'Log in with Google',
'google_signup' => 'Sign up with Google',
'github_login' => 'Log in with GitHub',
@ -78,9 +79,10 @@
],
'register' => [
'title' => 'Create an account',
'description' => 'Enter your details below to create your account',
'title' => 'Your whole social calendar, in one place',
'description' => 'Create your account and start scheduling posts across every network.',
'page_title' => 'Register',
'signup_with_email' => 'Sign up with email',
'name' => 'Name',
'name_placeholder' => 'Full name',
'email' => 'Email address',

View file

@ -40,6 +40,7 @@
],
'or_continue_with' => 'O continuar con',
'or_continue_with_email' => 'O continúa con correo',
'google_login' => 'Iniciar sesión con Google',
'google_signup' => 'Registrarse con Google',
'github_login' => 'Iniciar sesión con GitHub',
@ -66,9 +67,10 @@
],
'register' => [
'title' => 'Crear una cuenta',
'description' => 'Introduce tus datos para crear tu cuenta',
'title' => 'Todo tu calendario social en un solo lugar',
'description' => 'Crea tu cuenta y empieza a programar publicaciones en todas las redes.',
'page_title' => 'Registro',
'signup_with_email' => 'Registrarse con correo',
'name' => 'Nombre',
'name_placeholder' => 'Nombre completo',
'email' => 'Correo electrónico',

View file

@ -52,6 +52,7 @@
],
'or_continue_with' => 'Ou continue com',
'or_continue_with_email' => 'Ou continue com e-mail',
'google_login' => 'Entrar com Google',
'google_signup' => 'Cadastrar com Google',
'github_login' => 'Entrar com GitHub',
@ -78,9 +79,10 @@
],
'register' => [
'title' => 'Criar uma conta',
'description' => 'Digite seus dados abaixo para criar sua conta',
'title' => 'Todo o seu calendário social num só lugar',
'description' => 'Crie sua conta e comece a agendar posts em todas as redes.',
'page_title' => 'Cadastro',
'signup_with_email' => 'Cadastrar com e-mail',
'name' => 'Nome',
'name_placeholder' => 'Nome completo',
'email' => 'Endereço de email',

View file

@ -6,9 +6,13 @@ import { Button } from '@/components/ui/button';
import { redirect as githubRedirect } from '@/routes/auth/github';
import { redirect as googleRedirect } from '@/routes/auth/google';
defineProps<{
mode: 'login' | 'signup';
}>();
withDefaults(
defineProps<{
mode: 'login' | 'signup';
hideDivider?: boolean;
}>(),
{ hideDivider: false },
);
const page = usePage();
const googleEnabled = computed(() => Boolean(page.props.googleAuthEnabled));
@ -31,6 +35,7 @@ const hasSocial = computed(() => googleEnabled.value || githubEnabled.value);
</div>
<div
v-if="!hideDivider"
class="relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t after:border-border"
>
<span class="relative z-10 bg-background px-2 text-muted-foreground">{{ $t('auth.or_continue_with') }}</span>

View file

@ -1,6 +1,6 @@
<script setup lang="ts">
import { Form, Head, usePage } from '@inertiajs/vue3';
import { IconEye, IconEyeOff } from '@tabler/icons-vue';
import { IconEye, IconEyeOff, IconMail } from '@tabler/icons-vue';
import { computed, ref } from 'vue';
import SocialLogin from '@/components/auth/SocialLogin.vue';
@ -26,11 +26,21 @@ defineProps<{
}>();
const showPassword = ref(false);
const showEmailForm = ref(false);
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
const page = usePage();
const isSelfHosted = computed(() => Boolean(page.props.selfHosted));
const hasSocial = computed(
() =>
Boolean(page.props.googleAuthEnabled) ||
Boolean(page.props.githubAuthEnabled),
);
// With no social providers the email form is the only way to sign up, so it
// stays visible; otherwise it is revealed by the "Sign up with email" toggle.
const emailFormVisible = computed(() => !hasSocial.value || showEmailForm.value);
</script>
<template>
@ -41,7 +51,21 @@ const isSelfHosted = computed(() => Boolean(page.props.selfHosted));
<Head :title="$t('auth.register.page_title')" />
<div class="flex flex-col gap-6">
<SocialLogin mode="signup" />
<div v-if="hasSocial" class="flex flex-col gap-2">
<SocialLogin mode="signup" hide-divider />
<Button
v-if="!showEmailForm"
type="button"
variant="outline"
class="w-full"
dusk="register-email-toggle"
@click="showEmailForm = true"
>
<IconMail class="size-4" />
{{ $t('auth.register.signup_with_email') }}
</Button>
</div>
<Form
v-bind="store.form()"
@ -51,82 +75,96 @@ const isSelfHosted = computed(() => Boolean(page.props.selfHosted));
>
<input v-if="redirect" type="hidden" name="redirect" :value="redirect" />
<input type="hidden" name="timezone" :value="timezone" />
<div class="grid gap-6">
<div class="grid gap-2">
<Label for="name">{{ $t('auth.register.name') }}</Label>
<Input
id="name"
type="text"
autofocus
:tabindex="1"
autocomplete="name"
name="name"
:placeholder="$t('auth.register.name_placeholder')"
/>
<InputError :message="errors.name" />
</div>
<div class="grid gap-2">
<Label for="email">{{ $t('auth.register.email') }}</Label>
<Input
id="email"
type="email"
:tabindex="2"
autocomplete="email"
name="email"
placeholder="email@example.com"
:default-value="email ?? ''"
/>
<InputError :message="errors.email" />
</div>
<div class="grid gap-2">
<Label for="password">{{ $t('auth.register.password') }}</Label>
<div class="relative">
<Input
id="password"
:type="showPassword ? 'text' : 'password'"
:tabindex="3"
autocomplete="new-password"
name="password"
:placeholder="$t('auth.register.password')"
/>
<div class="absolute inset-y-0 end-0 flex items-center pe-3">
<TooltipProvider>
<Tooltip>
<TooltipTrigger as-child>
<button
type="button"
:tabindex="-1"
class="cursor-pointer text-muted-foreground hover:text-foreground"
@click="showPassword = !showPassword"
>
<IconEyeOff v-if="showPassword" class="size-4" />
<IconEye v-else class="size-4" />
</button>
</TooltipTrigger>
<TooltipContent>
<p>{{ showPassword ? $t('auth.register.hide_password') : $t('auth.register.show_password') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
</div>
<InputError :message="errors.password" />
</div>
<Button
type="submit"
class="mt-2 w-full"
tabindex="4"
:disabled="processing"
data-test="register-user-button"
>
<Spinner v-if="processing" />
{{ $t('auth.register.submit') }}
</Button>
<div
v-if="hasSocial && showEmailForm"
class="relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t after:border-border"
>
<span class="relative z-10 bg-background px-2 text-muted-foreground">{{ $t('auth.or_continue_with_email') }}</span>
</div>
<Transition
enter-active-class="transition-all duration-300 ease-out"
enter-from-class="-translate-y-2 opacity-0"
enter-to-class="translate-y-0 opacity-100"
>
<div v-if="emailFormVisible" class="grid gap-6">
<div class="grid gap-2">
<Label for="name">{{ $t('auth.register.name') }}</Label>
<Input
id="name"
type="text"
autofocus
:tabindex="1"
autocomplete="name"
name="name"
:placeholder="$t('auth.register.name_placeholder')"
/>
<InputError :message="errors.name" />
</div>
<div class="grid gap-2">
<Label for="email">{{ $t('auth.register.email') }}</Label>
<Input
id="email"
type="email"
:tabindex="2"
autocomplete="email"
name="email"
placeholder="email@example.com"
:default-value="email ?? ''"
/>
<InputError :message="errors.email" />
</div>
<div class="grid gap-2">
<Label for="password">{{ $t('auth.register.password') }}</Label>
<div class="relative">
<Input
id="password"
:type="showPassword ? 'text' : 'password'"
:tabindex="3"
autocomplete="new-password"
name="password"
:placeholder="$t('auth.register.password')"
/>
<div class="absolute inset-y-0 end-0 flex items-center pe-3">
<TooltipProvider>
<Tooltip>
<TooltipTrigger as-child>
<button
type="button"
:tabindex="-1"
class="cursor-pointer text-muted-foreground hover:text-foreground"
@click="showPassword = !showPassword"
>
<IconEyeOff v-if="showPassword" class="size-4" />
<IconEye v-else class="size-4" />
</button>
</TooltipTrigger>
<TooltipContent>
<p>{{ showPassword ? $t('auth.register.hide_password') : $t('auth.register.show_password') }}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
</div>
<InputError :message="errors.password" />
</div>
<Button
type="submit"
class="mt-2 w-full"
tabindex="4"
:disabled="processing"
data-test="register-user-button"
>
<Spinner v-if="processing" />
{{ $t('auth.register.submit') }}
</Button>
</div>
</Transition>
<div class="text-center text-sm text-muted-foreground">
{{ $t('auth.register.has_account') }}
<TextLink