Skip to content

armgit / posta

Public Imported from GitHub
0

Self-hosted email delivery platform that enables applications to send emails via HTTP APIs while handling SMTP delivery, templates, storage, security, and analytics. Fully self-hostable alternative to services like SendGrid or Mailgun.

feat(web): redesign auth pages with a split brand panel layout

Jonas Kaninda4f0c4437faeb
diff --git a/web/src/views/auth/AuthLayout.vue b/web/src/views/auth/AuthLayout.vue
new file mode 100644
index 0000000..c6605f2
--- /dev/null
+++ b/web/src/views/auth/AuthLayout.vue
@@ -0,0 +1,241 @@
+<script setup lang="ts">
+// Shared chrome for the primary auth pages (sign in, sign up): a brand panel on
+// the left and a centered form column on the right, collapsing to the form alone
+// on narrow screens.
+//
+// Only the chrome lives here. Form styling stays in the page that owns the form,
+// because Vue's scoped CSS applies to slot content in the *parent's* scope, not
+// this component's — styling slotted markup from here would need :slotted() and
+// would couple the layout to each page's internals.
+import { useThemeStore } from '../../stores/theme'
+
+withDefaults(
+ defineProps<{
+ title: string
+ subtitle?: string
+ // Secondary pages (forgot / reset password) drop the brand panel and centre
+ // the form on its own — the hero is an entry-point flourish, and repeating
+ // it on a mid-flow step makes those pages feel heavier than they are.
+ hero?: boolean
+ }>(),
+ { hero: true }
+)
+
+const theme = useThemeStore()
+</script>
+
+<template>
+ <div class="auth" :class="{ 'auth-no-hero': !hero }">
+ <!-- Brand panel. Decorative and duplicated by the form column's own
+ heading, so it is hidden from assistive tech. -->
+ <aside v-if="hero" class="auth-hero" aria-hidden="true">
+ <div class="auth-hero-inner">
+ <div class="auth-hero-wordmark">Posta<span class="wm-dot">.</span></div>
+
+ <div class="auth-hero-body">
+ <h2 class="auth-hero-title">Email infrastructure,<br />self-hosted.</h2>
+ <p class="auth-hero-lead">
+ Send transactional and marketing email, receive and parse inbound
+ messages — all through a single HTTP API.
+ </p>
+ <ul class="auth-hero-features">
+ <li><span class="mdi mdi-email-fast-outline"></span> Transactional &amp; marketing email</li>
+ <li><span class="mdi mdi-file-document-multiple-outline"></span> Templates &amp; localization</li>
+ <li><span class="mdi mdi-bullhorn-outline"></span> Campaigns &amp; subscriber lists</li>
+ <li><span class="mdi mdi-webhook"></span> Inbound parsing &amp; webhooks</li>
+ <li><span class="mdi mdi-chart-areaspline"></span> Delivery analytics &amp; tracking</li>
+ <li><span class="mdi mdi-account-group-outline"></span> Workspaces &amp; RBAC</li>
+ </ul>
+ </div>
+
+ <p class="auth-hero-foot">Open-source · Self-hosted email platform</p>
+ </div>
+ </aside>
+
+ <main class="auth-main">
+ <div class="auth-card">
+ <div class="auth-header">
+ <div class="auth-wordmark" aria-label="Posta">Posta<span class="auth-wordmark-dot">.</span></div>
+ <h1 class="auth-title">{{ title }}</h1>
+ <p v-if="subtitle" class="auth-subtitle">{{ subtitle }}</p>
+ </div>
+
+ <slot />
+ </div>
+ </main>
+
+ <button
+ class="theme-btn"
+ :title="theme.isDark ? 'Light mode' : 'Dark mode'"
+ :aria-label="theme.isDark ? 'Switch to light mode' : 'Switch to dark mode'"
+ @click="theme.toggle()"
+ >
+ <svg v-if="theme.isDark" width="18" height="18" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="3" stroke="currentColor" stroke-width="1.5"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.41 1.41M11.54 11.54l1.41 1.41M3.05 12.95l1.41-1.41M11.54 4.46l1.41-1.41" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
+ <svg v-else width="18" height="18" viewBox="0 0 16 16" fill="none"><path d="M14 9.5A6.5 6.5 0 016.5 2 6.5 6.5 0 1014 9.5z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
+ </button>
+ </div>
+</template>
+
+<style scoped>
+.auth {
+ min-height: 100vh;
+ display: grid;
+ grid-template-columns: 1.05fr 1fr;
+ background: var(--bg-primary);
+ position: relative;
+}
+
+/* ─── Brand panel ─── */
+.auth-hero {
+ position: relative;
+ overflow: hidden;
+ display: flex;
+ color: #fff;
+ background:
+ radial-gradient(120% 80% at 100% 0%, rgba(255, 255, 255, 0.16), transparent 55%),
+ radial-gradient(90% 70% at 0% 100%, rgba(13, 20, 36, 0.5), transparent 60%),
+ linear-gradient(150deg, var(--primary-600) 0%, var(--primary-800) 70%, #2a0f4d 100%);
+}
+/* Oversized wordmark watermark, echoing the lockup above it. */
+.auth-hero::after {
+ content: 'P';
+ position: absolute;
+ right: -4%;
+ bottom: -22%;
+ font-size: 34rem;
+ font-weight: 800;
+ line-height: 1;
+ color: #fff;
+ opacity: 0.05;
+ pointer-events: none;
+ user-select: none;
+}
+.auth-hero-inner {
+ position: relative;
+ z-index: 1;
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ max-width: 460px;
+ margin: auto;
+ padding: 56px 52px;
+}
+.auth-hero-wordmark {
+ align-self: flex-start;
+ margin-bottom: auto;
+ font-size: 1.6rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ color: #fff;
+}
+.auth-hero-wordmark .wm-dot { color: var(--primary-400); }
+
+.auth-hero-body { margin: 48px 0; }
+.auth-hero-title {
+ font-size: clamp(1.9rem, 2.6vw, 2.6rem);
+ font-weight: 800;
+ line-height: 1.1;
+ letter-spacing: -0.02em;
+ margin: 0 0 16px;
+}
+.auth-hero-lead {
+ font-size: 15px;
+ line-height: 1.6;
+ color: rgba(255, 255, 255, 0.82);
+ max-width: 42ch;
+ margin: 0 0 28px;
+}
+.auth-hero-features {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+}
+.auth-hero-features li {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ font-size: 14px;
+ color: rgba(255, 255, 255, 0.92);
+}
+.auth-hero-features .mdi {
+ font-size: 20px;
+ flex-shrink: 0;
+ width: 34px;
+ height: 34px;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: var(--radius);
+ background: rgba(255, 255, 255, 0.12);
+}
+.auth-hero-foot {
+ margin: 0;
+ font-size: 12.5px;
+ color: rgba(255, 255, 255, 0.6);
+}
+
+/* ─── Form column ─── */
+.auth-main {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 40px 24px;
+}
+.auth-card {
+ width: 100%;
+ max-width: 380px;
+}
+.auth-header { text-align: center; margin-bottom: 24px; }
+.auth-wordmark {
+ font-size: 32px;
+ font-weight: 800;
+ letter-spacing: -1px;
+ color: var(--text-primary);
+ margin-bottom: 20px;
+ line-height: 1;
+}
+.auth-wordmark-dot {
+ color: var(--primary-500);
+ margin-left: 1px;
+}
+.auth-title {
+ font-size: 22px;
+ font-weight: 600;
+ color: var(--text-primary);
+ letter-spacing: -0.2px;
+ margin: 0 0 8px;
+}
+.auth-subtitle {
+ font-size: 14px;
+ color: var(--text-muted);
+ margin: 0;
+}
+
+.theme-btn {
+ position: fixed;
+ top: 20px;
+ right: 20px;
+ background: var(--bg-primary);
+ border: 1px solid var(--border-primary);
+ border-radius: var(--radius);
+ padding: 10px;
+ cursor: pointer;
+ color: var(--text-tertiary);
+ display: flex;
+ align-items: center;
+ transition: all var(--transition);
+ box-shadow: var(--shadow-sm);
+}
+.theme-btn:hover { color: var(--text-primary); border-color: var(--border-input); }
+
+.auth-no-hero { grid-template-columns: 1fr; }
+
+/* ─── Responsive: collapse to a single centered form ─── */
+@media (max-width: 900px) {
+ .auth { grid-template-columns: 1fr; }
+ .auth-hero { display: none; }
+}
+</style>
diff --git a/web/src/views/auth/ForgotPassword.vue b/web/src/views/auth/ForgotPassword.vue
index cfd2b86..436923f 100644
--- a/web/src/views/auth/ForgotPassword.vue
+++ b/web/src/views/auth/ForgotPassword.vue
@@ -1,9 +1,7 @@
<script setup lang="ts">
-import { ref, onMounted } from 'vue'
+import { ref, computed, onMounted } from 'vue'
import { authApi } from '../../api/auth'
-import { useThemeStore } from '../../stores/theme'
-
-const theme = useThemeStore()
+import AuthLayout from './AuthLayout.vue'
const email = ref('')
const emailError = ref('')
@@ -12,6 +10,11 @@ const sent = ref(false)
const message = ref('')
const emailInput = ref<HTMLInputElement | null>(null)
+const heading = computed(() => (sent.value ? 'Check your email' : 'Forgot your password?'))
+const subheading = computed(() =>
+ sent.value ? message.value : "Enter your account email and we'll send you a link to reset your password."
+)
+
onMounted(() => emailInput.value?.focus())
async function submit() {
@@ -34,97 +37,47 @@ async function submit() {
</script>
<template>
- <div class="auth-page">
- <div class="auth-card">
- <div class="auth-header">
- <div class="auth-wordmark" aria-label="Posta">Posta<span class="auth-wordmark-dot">.</span></div>
- <h1 class="auth-title">{{ sent ? 'Check your email' : 'Forgot your password?' }}</h1>
- <p class="auth-subtitle">
- {{ sent ? message : "Enter your account email and we'll send you a link to reset your password." }}
- </p>
- </div>
-
- <form v-if="!sent" class="auth-form" @submit.prevent="submit">
- <div class="form-group">
- <label class="form-label" for="email">Email</label>
- <input
- id="email"
- ref="emailInput"
- v-model="email"
- type="email"
- class="form-input"
- :class="{ 'form-input-error': emailError }"
- placeholder="[email protected]"
- autocomplete="email"
- :disabled="loading"
- :aria-invalid="!!emailError"
- :aria-describedby="emailError ? 'email-error' : undefined"
- @input="emailError = ''"
- />
- <small v-if="emailError" id="email-error" class="form-error">{{ emailError }}</small>
- </div>
- <button type="submit" class="btn btn-primary auth-btn" :disabled="loading">
- <span v-if="loading" class="spinner"></span>
- {{ loading ? 'Sending...' : 'Send reset link' }}
- </button>
- </form>
-
- <div v-else class="auth-form">
- <div class="auth-success" role="status">
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
- <span>Reset link sent. The link expires in 1 hour.</span>
- </div>
+ <AuthLayout :hero="false" :title="heading" :subtitle="subheading">
+ <form v-if="!sent" class="auth-form" @submit.prevent="submit">
+ <div class="form-group">
+ <label class="form-label" for="email">Email</label>
+ <input
+ id="email"
+ ref="emailInput"
+ v-model="email"
+ type="email"
+ class="form-input"
+ :class="{ 'form-input-error': emailError }"
+ placeholder="[email protected]"
+ autocomplete="email"
+ :disabled="loading"
+ :aria-invalid="!!emailError"
+ :aria-describedby="emailError ? 'email-error' : undefined"
+ @input="emailError = ''"
+ />
+ <small v-if="emailError" id="email-error" class="form-error">{{ emailError }}</small>
</div>
+ <button type="submit" class="btn btn-primary auth-btn" :disabled="loading">
+ <span v-if="loading" class="spinner"></span>
+ {{ loading ? 'Sending...' : 'Send reset link' }}
+ </button>
+ </form>
- <div class="auth-footer">
- <router-link :to="{ name: 'login' }">Back to sign in</router-link>
+ <div v-else class="auth-form">
+ <div class="auth-success" role="status">
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
+ <span>Reset link sent. The link expires in 1 hour.</span>
</div>
</div>
- <button class="theme-btn" @click="theme.toggle()" :title="theme.isDark ? 'Light mode' : 'Dark mode'">
- <svg v-if="theme.isDark" width="18" height="18" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="3" stroke="currentColor" stroke-width="1.5"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.41 1.41M11.54 11.54l1.41 1.41M3.05 12.95l1.41-1.41M11.54 4.46l1.41-1.41" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
- <svg v-else width="18" height="18" viewBox="0 0 16 16" fill="none"><path d="M14 9.5A6.5 6.5 0 016.5 2 6.5 6.5 0 1014 9.5z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
- </button>
- </div>
+ <div class="auth-footer">
+ <router-link :to="{ name: 'login' }">Back to sign in</router-link>
+ </div>
+ </AuthLayout>
</template>
<style scoped>
-.auth-page {
- min-height: 100vh;
- display: flex;
- align-items: center;
- justify-content: center;
- background: var(--bg-secondary);
- padding: 20px;
- position: relative;
-}
-.auth-card {
- width: 100%;
- max-width: 400px;
- background: var(--bg-primary);
- border: 1px solid var(--border-primary);
- border-radius: var(--radius-xl);
- box-shadow: var(--shadow-lg);
-}
-.auth-header { text-align: center; padding: 36px 32px 0; }
-.auth-wordmark {
- font-size: 32px;
- font-weight: 800;
- letter-spacing: -1px;
- color: var(--text-primary);
- margin-bottom: 24px;
- line-height: 1;
-}
-.auth-wordmark-dot { color: var(--primary-500); margin-left: 1px; }
-.auth-title {
- font-size: 22px;
- font-weight: 600;
- color: var(--text-primary);
- letter-spacing: -0.2px;
- margin: 0 0 8px;
-}
-.auth-subtitle { font-size: 14px; color: var(--text-muted); margin: 0; line-height: 1.5; }
-.auth-form { padding: 28px 32px 20px; }
+.auth-form { margin-top: 4px; }
.auth-btn { width: 100%; padding: 11px 18px; font-size: 15px; margin-top: 4px; }
.form-input-error { border-color: var(--danger-500, #ef4444); }
.form-error { display: block; font-size: 12px; color: var(--danger-600, #dc2626); margin-top: 6px; }
@@ -142,24 +95,9 @@ async function submit() {
.auth-success svg { flex-shrink: 0; }
.auth-footer {
text-align: center;
- padding: 0 32px 28px;
+ margin-top: 22px;
font-size: 14px;
color: var(--text-muted);
}
.auth-footer a { color: var(--primary-500); font-weight: 500; }
-.theme-btn {
- position: fixed;
- top: 20px;
- right: 20px;
- background: var(--bg-primary);
- border: 1px solid var(--border-primary);
- border-radius: var(--radius);
- padding: 10px;
- cursor: pointer;
- color: var(--text-tertiary);
- display: flex;
- align-items: center;
- box-shadow: var(--shadow-sm);
-}
-.theme-btn:hover { color: var(--text-primary); border-color: var(--border-input); }
</style>
diff --git a/web/src/views/auth/Login.vue b/web/src/views/auth/Login.vue
index a82dc84..018aa12 100644
--- a/web/src/views/auth/Login.vue
+++ b/web/src/views/auth/Login.vue
@@ -1,18 +1,17 @@
<script setup lang="ts">
-import { ref, onMounted, nextTick, watch } from 'vue'
+import { ref, computed, onMounted, nextTick, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { authApi } from '../../api/auth'
import { oauthApi } from '../../api/oauth'
import { useAuthStore } from '../../stores/auth'
import { useNotificationStore } from '../../stores/notification'
-import { useThemeStore } from '../../stores/theme'
+import AuthLayout from './AuthLayout.vue'
import type { OAuthProviderInfo } from '../../api/types'
const router = useRouter()
const route = useRoute()
const auth = useAuthStore()
const notification = useNotificationStore()
-const theme = useThemeStore()
const email = ref('')
const password = ref('')
@@ -33,6 +32,22 @@ const showPassword = ref(false)
const emailInput = ref<HTMLInputElement | null>(null)
const codeInput = ref<HTMLInputElement | null>(null)
+// Surface a Caps Lock warning while typing the password — a common cause of
+// "invalid credentials" on the first try.
+const capsOn = ref(false)
+function onCaps(e: KeyboardEvent) {
+ capsOn.value = e.getModifierState?.('CapsLock') ?? false
+}
+
+const heading = computed(() => {
+ if (requires2FA.value) return 'Two-factor authentication'
+ return ssoMode.value ? 'Continue with SSO' : 'Sign in to your account'
+})
+const subheading = computed(() => {
+ if (requires2FA.value) return 'Enter the code from your authenticator app.'
+ return ssoMode.value ? "We'll redirect you to your identity provider." : undefined
+})
+
onMounted(async () => {
emailInput.value?.focus()
try {
@@ -151,198 +166,145 @@ function resetLogin() {
</script>
<template>
- <div class="auth-page">
- <div class="auth-card">
- <div class="auth-header">
- <div class="auth-wordmark" aria-label="Posta">Posta<span class="auth-wordmark-dot">.</span></div>
- <h1 class="auth-title">
- {{ requires2FA ? 'Two-factor authentication' : (ssoMode ? 'Continue with SSO' : 'Sign in to your account') }}
- </h1>
- <p v-if="requires2FA" class="auth-subtitle">Enter the code from your authenticator app.</p>
- <p v-else-if="ssoMode" class="auth-subtitle">We'll redirect you to your identity provider.</p>
- </div>
-
- <!-- Error surfaced via redirect (OAuth failure, session revoked, etc.) -->
- <div v-if="loginError" class="auth-alert" role="alert">
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
- <span>{{ loginError.replace(/_/g, ' ') }}</span>
- </div>
+ <AuthLayout :title="heading" :subtitle="subheading">
+ <!-- Error surfaced via redirect (OAuth failure, session revoked, etc.) -->
+ <div v-if="loginError" class="auth-alert" role="alert">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
+ <span>{{ loginError.replace(/_/g, ' ') }}</span>
+ </div>
- <form class="auth-form" @submit.prevent="ssoMode ? submitSSO() : handleLogin()">
- <template v-if="!requires2FA">
- <div class="form-group">
- <label class="form-label" for="email">Email</label>
- <input
- id="email"
- ref="emailInput"
- v-model="email"
- type="email"
- class="form-input"
- :class="{ 'form-input-error': emailError }"
- placeholder="[email protected]"
- autocomplete="email"
- :disabled="loading || ssoChecking"
- :aria-invalid="!!emailError"
- :aria-describedby="emailError ? 'email-error' : undefined"
- @input="emailError = ''"
- />
- <small v-if="emailError" id="email-error" class="form-error">{{ emailError }}</small>
- </div>
- <div v-if="!ssoMode" class="form-group">
- <div class="form-label-row">
- <label class="form-label" for="password">Password</label>
- <router-link v-if="passwordResetEnabled" class="forgot-link" :to="{ name: 'forgot-password' }">
- Forgot password?
- </router-link>
- </div>
- <div class="password-wrap">
- <input
- id="password"
- v-model="password"
- :type="showPassword ? 'text' : 'password'"
- class="form-input"
- :class="{ 'form-input-error': passwordError }"
- placeholder="Enter your password"
- autocomplete="current-password"
- :disabled="loading"
- :aria-invalid="!!passwordError"
- :aria-describedby="passwordError ? 'password-error' : undefined"
- @input="passwordError = ''"
- />
- <button
- type="button"
- class="password-toggle"
- :aria-label="showPassword ? 'Hide password' : 'Show password'"
- :title="showPassword ? 'Hide password' : 'Show password'"
- @click="showPassword = !showPassword"
- >
- <svg v-if="showPassword" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
- <svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
- </button>
- </div>
- <small v-if="passwordError" id="password-error" class="form-error">{{ passwordError }}</small>
+ <form class="auth-form" @submit.prevent="ssoMode ? submitSSO() : handleLogin()">
+ <template v-if="!requires2FA">
+ <div class="form-group">
+ <label class="form-label" for="email">Email</label>
+ <input
+ id="email"
+ ref="emailInput"
+ v-model="email"
+ type="email"
+ class="form-input"
+ :class="{ 'form-input-error': emailError }"
+ placeholder="[email protected]"
+ autocomplete="email"
+ :disabled="loading || ssoChecking"
+ :aria-invalid="!!emailError"
+ :aria-describedby="emailError ? 'email-error' : undefined"
+ @input="emailError = ''"
+ />
+ <small v-if="emailError" id="email-error" class="form-error">{{ emailError }}</small>
+ </div>
+ <div v-if="!ssoMode" class="form-group">
+ <div class="form-label-row">
+ <label class="form-label" for="password">Password</label>
+ <router-link v-if="passwordResetEnabled" class="forgot-link" :to="{ name: 'forgot-password' }">
+ Forgot password?
+ </router-link>
</div>
- </template>
- <template v-else>
- <div class="form-group">
- <label class="form-label" for="2fa-code">Authentication code</label>
+ <div class="password-wrap">
<input
- id="2fa-code"
- ref="codeInput"
- v-model="twoFactorCode"
- type="text"
- class="form-input totp-input"
- :class="{ 'form-input-error': codeError }"
- placeholder="000000"
- maxlength="6"
- inputmode="numeric"
- autocomplete="one-time-code"
+ id="password"
+ v-model="password"
+ :type="showPassword ? 'text' : 'password'"
+ class="form-input"
+ :class="{ 'form-input-error': passwordError }"
+ placeholder="Enter your password"
+ autocomplete="current-password"
:disabled="loading"
- :aria-invalid="!!codeError"
- :aria-describedby="codeError ? 'code-error' : undefined"
+ :aria-invalid="!!passwordError"
+ :aria-describedby="passwordError ? 'password-error' : undefined"
+ @input="passwordError = ''"
+ @keyup="onCaps"
+ @keydown="onCaps"
/>
- <small v-if="codeError" id="code-error" class="form-error">{{ codeError }}</small>
+ <button
+ type="button"
+ class="password-toggle"
+ :aria-label="showPassword ? 'Hide password' : 'Show password'"
+ :title="showPassword ? 'Hide password' : 'Show password'"
+ @click="showPassword = !showPassword"
+ >
+ <svg v-if="showPassword" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
+ <svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
+ </button>
</div>
- </template>
- <button v-if="!ssoMode" type="submit" class="btn btn-primary auth-btn" :disabled="loading">
- <span v-if="loading" class="spinner"></span>
- {{ loading ? 'Signing in...' : 'Sign in' }}
- </button>
- <button v-if="ssoMode" type="submit" class="btn btn-primary auth-btn" :disabled="ssoChecking">
- <span v-if="ssoChecking" class="spinner"></span>
- {{ ssoChecking ? 'Checking...' : 'Continue' }}
- </button>
- <button v-if="!requires2FA && !ssoMode && ssoAvailable" type="button" class="btn btn-secondary auth-btn" style="margin-top: 8px" @click="enterSSOMode">
- Continue with SSO
- </button>
- <button v-if="ssoMode" type="button" class="btn btn-secondary auth-btn" style="margin-top: 8px" @click="exitSSOMode">
- Back to password sign in
- </button>
- <button v-if="requires2FA" type="button" class="btn btn-secondary auth-btn" style="margin-top: 8px" @click="resetLogin">
- Back to Login
- </button>
- </form>
-
- <!-- OAuth Providers -->
- <div v-if="oauthProviders.length > 0 && !requires2FA && !ssoMode" class="oauth-section">
- <div class="oauth-divider">
- <span>or</span>
+ <small v-if="passwordError" id="password-error" class="form-error">{{ passwordError }}</small>
+ <Transition name="fade">
+ <p v-if="capsOn" class="caps-hint">
+ <span class="mdi mdi-apple-keyboard-caps"></span> Caps Lock is on
+ </p>
+ </Transition>
</div>
- <div class="oauth-buttons">
- <button
- v-for="p in oauthProviders"
- :key="p.slug"
- class="btn btn-secondary auth-btn oauth-btn"
- @click="oauthLogin(p.slug)"
- >
- <svg v-if="p.type === 'google'" width="18" height="18" viewBox="0 0 24 24"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.97 10.97 0 001 12c0 1.77.42 3.45 1.18 4.93l3.66-2.84z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>
- <svg v-else width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg>
- Sign in with {{ p.name }}
- </button>
+ </template>
+ <template v-else>
+ <div class="form-group">
+ <label class="form-label" for="2fa-code">Authentication code</label>
+ <input
+ id="2fa-code"
+ ref="codeInput"
+ v-model="twoFactorCode"
+ type="text"
+ class="form-input totp-input"
+ :class="{ 'form-input-error': codeError }"
+ placeholder="000000"
+ maxlength="6"
+ inputmode="numeric"
+ autocomplete="one-time-code"
+ :disabled="loading"
+ :aria-invalid="!!codeError"
+ :aria-describedby="codeError ? 'code-error' : undefined"
+ />
+ <small v-if="codeError" id="code-error" class="form-error">{{ codeError }}</small>
</div>
+ </template>
+ <button v-if="!ssoMode" type="submit" class="btn btn-primary auth-btn" :disabled="loading">
+ <span v-if="loading" class="spinner"></span>
+ {{ loading ? 'Signing in...' : 'Sign in' }}
+ </button>
+ <button v-if="ssoMode" type="submit" class="btn btn-primary auth-btn" :disabled="ssoChecking">
+ <span v-if="ssoChecking" class="spinner"></span>
+ {{ ssoChecking ? 'Checking...' : 'Continue' }}
+ </button>
+ <button v-if="!requires2FA && !ssoMode && ssoAvailable" type="button" class="btn btn-secondary auth-btn" style="margin-top: 8px" @click="enterSSOMode">
+ Continue with SSO
+ </button>
+ <button v-if="ssoMode" type="button" class="btn btn-secondary auth-btn" style="margin-top: 8px" @click="exitSSOMode">
+ Back to password sign in
+ </button>
+ <button v-if="requires2FA" type="button" class="btn btn-secondary auth-btn" style="margin-top: 8px" @click="resetLogin">
+ Back to Login
+ </button>
+ </form>
+
+ <!-- OAuth Providers -->
+ <div v-if="oauthProviders.length > 0 && !requires2FA && !ssoMode" class="oauth-section">
+ <div class="oauth-divider">
+ <span>or</span>
</div>
-
- <div class="auth-footer">
- <template v-if="registrationEnabled">
- <span>Don't have an account?</span>
- <router-link to="/register">Sign up</router-link>
- </template>
- <span v-else>Contact your administrator for an account.</span>
+ <div class="oauth-buttons">
+ <button
+ v-for="p in oauthProviders"
+ :key="p.slug"
+ class="btn btn-secondary auth-btn oauth-btn"
+ @click="oauthLogin(p.slug)"
+ >
+ <svg v-if="p.type === 'google'" width="18" height="18" viewBox="0 0 24 24"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.97 10.97 0 001 12c0 1.77.42 3.45 1.18 4.93l3.66-2.84z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>
+ <svg v-else width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg>
+ Sign in with {{ p.name }}
+ </button>
</div>
</div>
- <button class="theme-btn" @click="theme.toggle()" :title="theme.isDark ? 'Light mode' : 'Dark mode'">
- <svg v-if="theme.isDark" width="18" height="18" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="3" stroke="currentColor" stroke-width="1.5"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.41 1.41M11.54 11.54l1.41 1.41M3.05 12.95l1.41-1.41M11.54 4.46l1.41-1.41" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
- <svg v-else width="18" height="18" viewBox="0 0 16 16" fill="none"><path d="M14 9.5A6.5 6.5 0 016.5 2 6.5 6.5 0 1014 9.5z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
- </button>
- </div>
+ <div class="auth-footer">
+ <template v-if="registrationEnabled">
+ <span>Don't have an account?</span>
+ <router-link to="/register">Sign up</router-link>
+ </template>
+ <span v-else>Contact your administrator for an account.</span>
+ </div>
+ </AuthLayout>
</template>
<style scoped>
-.auth-page {
- min-height: 100vh;
- display: flex;
- align-items: center;
- justify-content: center;
- background: var(--bg-secondary);
- padding: 20px;
- position: relative;
-}
-
-.auth-card {
- width: 100%;
- max-width: 400px;
- background: var(--bg-primary);
- border: 1px solid var(--border-primary);
- border-radius: var(--radius-xl);
- box-shadow: var(--shadow-lg);
-}
-
-.auth-header { text-align: center; padding: 36px 32px 0; }
-
-.auth-wordmark {
- font-size: 32px;
- font-weight: 800;
- letter-spacing: -1px;
- color: var(--text-primary);
- margin-bottom: 24px;
- line-height: 1;
-}
-.auth-wordmark-dot {
- color: var(--primary-500);
- margin-left: 1px;
-}
-
-.auth-title {
- font-size: 22px;
- font-weight: 600;
- color: var(--text-primary);
- letter-spacing: -0.2px;
- margin: 0 0 8px;
-}
-
-.auth-subtitle { font-size: 14px; color: var(--text-muted); margin: 0; }
-
.form-label-row {
display: flex;
align-items: baseline;
@@ -382,7 +344,22 @@ function resetLogin() {
margin-top: 6px;
}
-.auth-form { padding: 28px 32px 20px; }
+.auth-form { margin-top: 4px; }
+
+.caps-hint {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin: 6px 0 0;
+ font-size: 12px;
+ color: var(--warning-700, var(--text-muted));
+}
+.caps-hint .mdi { font-size: 15px; }
+
+.fade-enter-active,
+.fade-leave-active { transition: opacity 150ms ease; }
+.fade-enter-from,
+.fade-leave-to { opacity: 0; }
.auth-btn {
width: 100%;
@@ -400,7 +377,7 @@ function resetLogin() {
.auth-footer {
text-align: center;
- padding: 0 32px 28px;
+ margin-top: 22px;
font-size: 14px;
color: var(--text-muted);
display: flex;
@@ -409,24 +386,7 @@ function resetLogin() {
}
.auth-footer a { color: var(--primary-500); font-weight: 500; }
-.theme-btn {
- position: fixed;
- top: 20px;
- right: 20px;
- background: var(--bg-primary);
- border: 1px solid var(--border-primary);
- border-radius: var(--radius);
- padding: 10px;
- cursor: pointer;
- color: var(--text-tertiary);
- display: flex;
- align-items: center;
- transition: all var(--transition);
- box-shadow: var(--shadow-sm);
-}
-.theme-btn:hover { color: var(--text-primary); border-color: var(--border-input); }
-
-.oauth-section { padding: 0 32px 20px; }
+.oauth-section { margin-top: 18px; }
.oauth-divider {
display: flex;
@@ -461,7 +421,7 @@ function resetLogin() {
display: flex;
align-items: center;
gap: 8px;
- margin: 24px 32px 0;
+ margin-bottom: 16px;
padding: 10px 12px;
font-size: 13px;
color: var(--danger-700, #b91c1c);
diff --git a/web/src/views/auth/Register.vue b/web/src/views/auth/Register.vue
index dde9011..1202647 100644
--- a/web/src/views/auth/Register.vue
+++ b/web/src/views/auth/Register.vue
@@ -4,12 +4,11 @@ import { useRouter } from 'vue-router'
import { authApi } from '../../api/auth'
import { useAuthStore } from '../../stores/auth'
import { useNotificationStore } from '../../stores/notification'
-import { useThemeStore } from '../../stores/theme'
+import AuthLayout from './AuthLayout.vue'
const router = useRouter()
const auth = useAuthStore()
const notification = useNotificationStore()
-const theme = useThemeStore()
const name = ref('')
const email = ref('')
@@ -72,160 +71,107 @@ async function handleRegister() {
</script>
<template>
- <div class="auth-page" v-if="registrationEnabled">
- <div class="auth-card">
- <div class="auth-header">
- <div class="auth-wordmark" aria-label="Posta">Posta<span class="auth-wordmark-dot">.</span></div>
- <h1 class="auth-title">Create your account</h1>
- <p class="auth-subtitle">Get started in under a minute.</p>
+ <AuthLayout
+ v-if="registrationEnabled"
+ title="Create your account"
+ subtitle="Get started in under a minute."
+ >
+ <form class="auth-form" @submit.prevent="handleRegister">
+ <div class="form-group">
+ <label class="form-label" for="name">Name</label>
+ <input
+ id="name"
+ v-model="name"
+ type="text"
+ class="form-input"
+ :class="{ 'form-input-error': nameError }"
+ placeholder="Your name"
+ autocomplete="name"
+ @input="nameError = ''"
+ />
+ <small v-if="nameError" class="form-error">{{ nameError }}</small>
</div>
-
- <form class="auth-form" @submit.prevent="handleRegister">
- <div class="form-group">
- <label class="form-label" for="name">Name</label>
+ <div class="form-group">
+ <label class="form-label" for="email">Email</label>
+ <input
+ id="email"
+ v-model="email"
+ type="email"
+ class="form-input"
+ :class="{ 'form-input-error': emailError }"
+ placeholder="[email protected]"
+ autocomplete="email"
+ @input="emailError = ''"
+ />
+ <small v-if="emailError" class="form-error">{{ emailError }}</small>
+ </div>
+ <div class="form-group">
+ <label class="form-label" for="password">Password</label>
+ <div class="password-wrap">
<input
- id="name"
- v-model="name"
- type="text"
+ id="password"
+ v-model="password"
+ :type="showPassword ? 'text' : 'password'"
class="form-input"
- :class="{ 'form-input-error': nameError }"
- placeholder="Your name"
- autocomplete="name"
- @input="nameError = ''"
+ :class="{ 'form-input-error': passwordError }"
+ placeholder="Minimum 8 characters"
+ autocomplete="new-password"
+ @input="passwordError = ''"
/>
- <small v-if="nameError" class="form-error">{{ nameError }}</small>
+ <button
+ type="button"
+ class="password-toggle"
+ :aria-label="showPassword ? 'Hide password' : 'Show password'"
+ :title="showPassword ? 'Hide password' : 'Show password'"
+ @click="showPassword = !showPassword"
+ >
+ <svg v-if="showPassword" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
+ <svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
+ </button>
</div>
- <div class="form-group">
- <label class="form-label" for="email">Email</label>
+ <small v-if="passwordError" class="form-error">{{ passwordError }}</small>
+ </div>
+ <div class="form-group">
+ <label class="form-label" for="confirm-password">Confirm password</label>
+ <div class="password-wrap">
<input
- id="email"
- v-model="email"
- type="email"
+ id="confirm-password"
+ v-model="confirmPassword"
+ :type="showConfirm ? 'text' : 'password'"
class="form-input"
- :class="{ 'form-input-error': emailError }"
- placeholder="[email protected]"
- autocomplete="email"
- @input="emailError = ''"
+ :class="{ 'form-input-error': confirmError }"
+ placeholder="Re-enter your password"
+ autocomplete="new-password"
+ @input="confirmError = ''"
/>
- <small v-if="emailError" class="form-error">{{ emailError }}</small>
- </div>
- <div class="form-group">
- <label class="form-label" for="password">Password</label>
- <div class="password-wrap">
- <input
- id="password"
- v-model="password"
- :type="showPassword ? 'text' : 'password'"
- class="form-input"
- :class="{ 'form-input-error': passwordError }"
- placeholder="Minimum 8 characters"
- autocomplete="new-password"
- @input="passwordError = ''"
- />
- <button
- type="button"
- class="password-toggle"
- :aria-label="showPassword ? 'Hide password' : 'Show password'"
- :title="showPassword ? 'Hide password' : 'Show password'"
- @click="showPassword = !showPassword"
- >
- <svg v-if="showPassword" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
- <svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
- </button>
- </div>
- <small v-if="passwordError" class="form-error">{{ passwordError }}</small>
+ <button
+ type="button"
+ class="password-toggle"
+ :aria-label="showConfirm ? 'Hide password' : 'Show password'"
+ :title="showConfirm ? 'Hide password' : 'Show password'"
+ @click="showConfirm = !showConfirm"
+ >
+ <svg v-if="showConfirm" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
+ <svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
+ </button>
</div>
- <div class="form-group">
- <label class="form-label" for="confirm-password">Confirm password</label>
- <div class="password-wrap">
- <input
- id="confirm-password"
- v-model="confirmPassword"
- :type="showConfirm ? 'text' : 'password'"
- class="form-input"
- :class="{ 'form-input-error': confirmError }"
- placeholder="Re-enter your password"
- autocomplete="new-password"
- @input="confirmError = ''"
- />
- <button
- type="button"
- class="password-toggle"
- :aria-label="showConfirm ? 'Hide password' : 'Show password'"
- :title="showConfirm ? 'Hide password' : 'Show password'"
- @click="showConfirm = !showConfirm"
- >
- <svg v-if="showConfirm" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
- <svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
- </button>
- </div>
- <small v-if="confirmError" class="form-error">{{ confirmError }}</small>
- </div>
- <button type="submit" class="btn btn-primary auth-btn" :disabled="loading">
- <span v-if="loading" class="spinner"></span>
- {{ loading ? 'Creating account…' : 'Create account' }}
- </button>
- </form>
-
- <div class="auth-footer">
- <span>Already have an account?</span>
- <router-link to="/login">Sign in</router-link>
+ <small v-if="confirmError" class="form-error">{{ confirmError }}</small>
</div>
+ <button type="submit" class="btn btn-primary auth-btn" :disabled="loading">
+ <span v-if="loading" class="spinner"></span>
+ {{ loading ? 'Creating account…' : 'Create account' }}
+ </button>
+ </form>
+
+ <div class="auth-footer">
+ <span>Already have an account?</span>
+ <router-link to="/login">Sign in</router-link>
</div>
-
- <button class="theme-btn" @click="theme.toggle()" :title="theme.isDark ? 'Light mode' : 'Dark mode'">
- <svg v-if="theme.isDark" width="18" height="18" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="3" stroke="currentColor" stroke-width="1.5"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.41 1.41M11.54 11.54l1.41 1.41M3.05 12.95l1.41-1.41M11.54 4.46l1.41-1.41" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
- <svg v-else width="18" height="18" viewBox="0 0 16 16" fill="none"><path d="M14 9.5A6.5 6.5 0 016.5 2 6.5 6.5 0 1014 9.5z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
- </button>
- </div>
+ </AuthLayout>
</template>
<style scoped>
-.auth-page {
- min-height: 100vh;
- display: flex;
- align-items: center;
- justify-content: center;
- background: var(--bg-secondary);
- padding: 20px;
- position: relative;
-}
-
-.auth-card {
- width: 100%;
- max-width: 400px;
- background: var(--bg-primary);
- border: 1px solid var(--border-primary);
- border-radius: var(--radius-xl);
- box-shadow: var(--shadow-lg);
-}
-
-.auth-header { text-align: center; padding: 36px 32px 0; }
-
-.auth-wordmark {
- font-size: 32px;
- font-weight: 800;
- letter-spacing: -1px;
- color: var(--text-primary);
- margin-bottom: 24px;
- line-height: 1;
-}
-.auth-wordmark-dot {
- color: var(--primary-500);
- margin-left: 1px;
-}
-
-.auth-title {
- font-size: 22px;
- font-weight: 600;
- color: var(--text-primary);
- letter-spacing: -0.2px;
- margin: 0 0 8px;
-}
-
-.auth-subtitle { font-size: 14px; color: var(--text-muted); margin: 0; }
-
-.auth-form { padding: 28px 32px 20px; }
+.auth-form { margin-top: 4px; }
.auth-btn {
width: 100%;
@@ -264,7 +210,7 @@ async function handleRegister() {
.auth-footer {
text-align: center;
- padding: 0 32px 28px;
+ margin-top: 22px;
font-size: 14px;
color: var(--text-muted);
display: flex;
@@ -272,21 +218,4 @@ async function handleRegister() {
justify-content: center;
}
.auth-footer a { color: var(--primary-500); font-weight: 500; }
-
-.theme-btn {
- position: fixed;
- top: 20px;
- right: 20px;
- background: var(--bg-primary);
- border: 1px solid var(--border-primary);
- border-radius: var(--radius);
- padding: 10px;
- cursor: pointer;
- color: var(--text-tertiary);
- display: flex;
- align-items: center;
- transition: all var(--transition);
- box-shadow: var(--shadow-sm);
-}
-.theme-btn:hover { color: var(--text-primary); border-color: var(--border-input); }
</style>
diff --git a/web/src/views/auth/ResetPassword.vue b/web/src/views/auth/ResetPassword.vue
index 1d71c4b..9de5bf0 100644
--- a/web/src/views/auth/ResetPassword.vue
+++ b/web/src/views/auth/ResetPassword.vue
@@ -3,12 +3,11 @@ import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { authApi } from '../../api/auth'
import { useNotificationStore } from '../../stores/notification'
-import { useThemeStore } from '../../stores/theme'
+import AuthLayout from './AuthLayout.vue'
const route = useRoute()
const router = useRouter()
const notify = useNotificationStore()
-const theme = useThemeStore()
const token = ref((route.query.token as string) || '')
const password = ref('')
@@ -46,123 +45,79 @@ async function submit() {
</script>
<template>
- <div class="auth-page">
- <div class="auth-card">
- <div class="auth-header">
- <div class="auth-wordmark" aria-label="Posta">Posta<span class="auth-wordmark-dot">.</span></div>
- <h1 class="auth-title">Set a new password</h1>
- <p class="auth-subtitle">Choose a strong password you don't use elsewhere.</p>
- </div>
-
- <div v-if="!token" class="auth-form">
- <div class="auth-alert" role="alert">
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
- <span>This reset link is missing its token. Request a new one.</span>
- </div>
+ <AuthLayout
+ :hero="false"
+ title="Set a new password"
+ subtitle="Choose a strong password you don&apos;t use elsewhere."
+ >
+ <div v-if="!token" class="auth-form">
+ <div class="auth-alert" role="alert">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
+ <span>This reset link is missing its token. Request a new one.</span>
</div>
+ </div>
- <form v-else class="auth-form" @submit.prevent="submit">
- <div class="form-group">
- <label class="form-label" for="password">New password</label>
- <div class="password-wrap">
- <input
- id="password"
- ref="passwordInput"
- v-model="password"
- :type="showPassword ? 'text' : 'password'"
- class="form-input"
- :class="{ 'form-input-error': passwordError }"
- placeholder="At least 8 characters"
- autocomplete="new-password"
- :disabled="loading"
- :aria-invalid="!!passwordError"
- :aria-describedby="passwordError ? 'password-error' : undefined"
- @input="passwordError = ''"
- />
- <button
- type="button"
- class="password-toggle"
- :aria-label="showPassword ? 'Hide password' : 'Show password'"
- @click="showPassword = !showPassword"
- >
- <svg v-if="showPassword" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
- <svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
- </button>
- </div>
- <small v-if="passwordError" id="password-error" class="form-error">{{ passwordError }}</small>
- </div>
- <div class="form-group">
- <label class="form-label" for="confirm">Confirm password</label>
+ <form v-else class="auth-form" @submit.prevent="submit">
+ <div class="form-group">
+ <label class="form-label" for="password">New password</label>
+ <div class="password-wrap">
<input
- id="confirm"
- v-model="confirm"
+ id="password"
+ ref="passwordInput"
+ v-model="password"
:type="showPassword ? 'text' : 'password'"
class="form-input"
- :class="{ 'form-input-error': confirmError }"
- placeholder="Re-enter your password"
+ :class="{ 'form-input-error': passwordError }"
+ placeholder="At least 8 characters"
autocomplete="new-password"
:disabled="loading"
- :aria-invalid="!!confirmError"
- :aria-describedby="confirmError ? 'confirm-error' : undefined"
- @input="confirmError = ''"
+ :aria-invalid="!!passwordError"
+ :aria-describedby="passwordError ? 'password-error' : undefined"
+ @input="passwordError = ''"
/>
- <small v-if="confirmError" id="confirm-error" class="form-error">{{ confirmError }}</small>
+ <button
+ type="button"
+ class="password-toggle"
+ :aria-label="showPassword ? 'Hide password' : 'Show password'"
+ @click="showPassword = !showPassword"
+ >
+ <svg v-if="showPassword" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
+ <svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
+ </button>
</div>
- <button type="submit" class="btn btn-primary auth-btn" :disabled="loading">
- <span v-if="loading" class="spinner"></span>
- {{ loading ? 'Resetting...' : 'Reset password' }}
- </button>
- </form>
-
- <div class="auth-footer">
- <router-link :to="{ name: 'login' }">Back to sign in</router-link>
+ <small v-if="passwordError" id="password-error" class="form-error">{{ passwordError }}</small>
</div>
- </div>
+ <div class="form-group">
+ <label class="form-label" for="confirm">Confirm password</label>
+ <input
+ id="confirm"
+ v-model="confirm"
+ :type="showPassword ? 'text' : 'password'"
+ class="form-input"
+ :class="{ 'form-input-error': confirmError }"
+ placeholder="Re-enter your password"
+ autocomplete="new-password"
+ :disabled="loading"
+ :aria-invalid="!!confirmError"
+ :aria-describedby="confirmError ? 'confirm-error' : undefined"
+ @input="confirmError = ''"
+ />
+ <small v-if="confirmError" id="confirm-error" class="form-error">{{ confirmError }}</small>
+ </div>
+ <button type="submit" class="btn btn-primary auth-btn" :disabled="loading">
+ <span v-if="loading" class="spinner"></span>
+ {{ loading ? 'Resetting...' : 'Reset password' }}
+ </button>
+ </form>
- <button class="theme-btn" @click="theme.toggle()" :title="theme.isDark ? 'Light mode' : 'Dark mode'">
- <svg v-if="theme.isDark" width="18" height="18" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="3" stroke="currentColor" stroke-width="1.5"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.41 1.41M11.54 11.54l1.41 1.41M3.05 12.95l1.41-1.41M11.54 4.46l1.41-1.41" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
- <svg v-else width="18" height="18" viewBox="0 0 16 16" fill="none"><path d="M14 9.5A6.5 6.5 0 016.5 2 6.5 6.5 0 1014 9.5z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
- </button>
- </div>
+ <div class="auth-footer">
+ <router-link :to="{ name: 'login' }">Back to sign in</router-link>
+ </div>
+ </AuthLayout>
</template>
<style scoped>
-.auth-page {
- min-height: 100vh;
- display: flex;
- align-items: center;
- justify-content: center;
- background: var(--bg-secondary);
- padding: 20px;
- position: relative;
-}
-.auth-card {
- width: 100%;
- max-width: 400px;
- background: var(--bg-primary);
- border: 1px solid var(--border-primary);
- border-radius: var(--radius-xl);
- box-shadow: var(--shadow-lg);
-}
-.auth-header { text-align: center; padding: 36px 32px 0; }
-.auth-wordmark {
- font-size: 32px;
- font-weight: 800;
- letter-spacing: -1px;
- color: var(--text-primary);
- margin-bottom: 24px;
- line-height: 1;
-}
-.auth-wordmark-dot { color: var(--primary-500); margin-left: 1px; }
-.auth-title {
- font-size: 22px;
- font-weight: 600;
- color: var(--text-primary);
- letter-spacing: -0.2px;
- margin: 0 0 8px;
-}
-.auth-subtitle { font-size: 14px; color: var(--text-muted); margin: 0; line-height: 1.5; }
-.auth-form { padding: 28px 32px 20px; }
+.auth-form { margin-top: 4px; }
.auth-btn { width: 100%; padding: 11px 18px; font-size: 15px; margin-top: 4px; }
.password-wrap { position: relative; }
.password-wrap .form-input { padding-right: 40px; }
@@ -197,24 +152,9 @@ async function submit() {
.auth-alert svg { flex-shrink: 0; }
.auth-footer {
text-align: center;
- padding: 0 32px 28px;
+ margin-top: 22px;
font-size: 14px;
color: var(--text-muted);
}
.auth-footer a { color: var(--primary-500); font-weight: 500; }
-.theme-btn {
- position: fixed;
- top: 20px;
- right: 20px;
- background: var(--bg-primary);
- border: 1px solid var(--border-primary);
- border-radius: var(--radius);
- padding: 10px;
- cursor: pointer;
- color: var(--text-tertiary);
- display: flex;
- align-items: center;
- box-shadow: var(--shadow-sm);
-}
-.theme-btn:hover { color: var(--text-primary); border-color: var(--border-input); }
</style>