feat: add self-registration frontend
Components: - Register.jsx: Registration form with validation - Verify.jsx: Email verification page with auto-login - API calls: register(), verifyEmail() Features: - Form validation (name min 2, email format, password min 8, password confirm) - Success screen after registration (check email) - Auto-login after verification → redirect to dashboard - Error handling for invalid/expired tokens - Link to registration from login page Routes: - /register → public (no login required) - /verify?token=xxx → public - Pattern matches existing /reset-password handling UX: - Clean success/error states - Loading spinners - Auto-redirect after verify (2s) - "Jetzt registrieren" link on login Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
c1562a27f4
commit
86f7a513fe
5 files changed
+336
-2
No files matched your search
+21
-2
@@ -8,6 +8,8 @@ import { Avatar } from './pages/ProfileSelect'
|
||||
import SetupScreen from './pages/SetupScreen'
|
||||
import { ResetPassword } from './pages/PasswordRecovery'
|
||||
import LoginScreen from './pages/LoginScreen'
|
||||
import Register from './pages/Register'
|
||||
import Verify from './pages/Verify'
|
||||
import Dashboard from './pages/Dashboard'
|
||||
import CaptureHub from './pages/CaptureHub'
|
||||
import WeightScreen from './pages/WeightScreen'
|
||||
@@ -59,9 +61,26 @@ function AppShell() {
|
||||
}
|
||||
}, [session?.profile_id])
|
||||
|
||||
// Handle password reset link
|
||||
// Handle public pages (register, verify, reset-password)
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
const resetToken = urlParams.get('reset-password') || (window.location.pathname === '/reset-password' ? urlParams.get('token') : null)
|
||||
const currentPath = window.location.pathname
|
||||
|
||||
// Register page
|
||||
if (currentPath === '/register') return (
|
||||
<div style={{minHeight:'100vh',background:'var(--bg)',padding:24}}>
|
||||
<Register/>
|
||||
</div>
|
||||
)
|
||||
|
||||
// Verify email page
|
||||
if (currentPath === '/verify') return (
|
||||
<div style={{minHeight:'100vh',background:'var(--bg)',padding:24}}>
|
||||
<Verify/>
|
||||
</div>
|
||||
)
|
||||
|
||||
// Password reset page
|
||||
const resetToken = urlParams.get('reset-password') || (currentPath === '/reset-password' ? urlParams.get('token') : null)
|
||||
if (resetToken) return (
|
||||
<div style={{minHeight:'100vh',display:'flex',alignItems:'center',justifyContent:'center',
|
||||
background:'var(--bg)',padding:24}}>
|
||||
|
||||
Reference in new issue
Block a user