Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
132 lines
3.9 KiB
TypeScript
132 lines
3.9 KiB
TypeScript
'use client'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
import { Suspense, useState, useEffect } from 'react'
|
|
import { useRouter, useSearchParams } from 'next/navigation'
|
|
import Link from 'next/link'
|
|
import { authService } from '@/services/authService'
|
|
import { getErrorMessage } from '@/utils/error'
|
|
|
|
function ResetPasswordContent() {
|
|
const router = useRouter()
|
|
const searchParams = useSearchParams()
|
|
const token = searchParams.get('token')
|
|
const [password, setPassword] = useState('')
|
|
const [confirmPassword, setConfirmPassword] = useState('')
|
|
const [loading, setLoading] = useState(false)
|
|
const [error, setError] = useState('')
|
|
const [success, setSuccess] = useState(false)
|
|
|
|
useEffect(() => {
|
|
if (!token) {
|
|
router.push('/forgot-password')
|
|
}
|
|
}, [token, router])
|
|
|
|
const handleSubmit = async (e: React.FormEvent) => {
|
|
e.preventDefault()
|
|
setError('')
|
|
|
|
if (password !== confirmPassword) {
|
|
setError('Passwords do not match')
|
|
return
|
|
}
|
|
|
|
if (password.length < 6) {
|
|
setError('Password must be at least 6 characters')
|
|
return
|
|
}
|
|
|
|
if (!token) return
|
|
|
|
setLoading(true)
|
|
try {
|
|
await authService.resetPassword(token, password)
|
|
setSuccess(true)
|
|
setTimeout(() => {
|
|
router.push('/login')
|
|
}, 2000)
|
|
} catch (err: unknown) {
|
|
setError(getErrorMessage(err))
|
|
} finally {
|
|
setLoading(false)
|
|
}
|
|
}
|
|
|
|
if (success) {
|
|
return (
|
|
<div className="w-full max-w-md mx-auto px-4 py-8 text-center">
|
|
<h1 className="text-2xl font-bold text-foreground mb-4">Password Reset</h1>
|
|
<p className="text-foreground/70 mb-6">Your password has been reset successfully!</p>
|
|
<p className="text-foreground/50">Redirecting to login...</p>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div className="w-full max-w-md mx-auto px-4 py-8">
|
|
<h1 className="text-3xl font-bold text-foreground mb-2">Reset Password</h1>
|
|
<p className="text-foreground/70 mb-8">Enter your new password</p>
|
|
|
|
<form onSubmit={handleSubmit} className="space-y-4">
|
|
{error && (
|
|
<div className="bg-red-500/10 border border-red-500 text-red-500 px-4 py-3 rounded">
|
|
{error}
|
|
</div>
|
|
)}
|
|
|
|
<div>
|
|
<label htmlFor="password" className="block text-sm font-medium text-foreground mb-2">
|
|
New Password
|
|
</label>
|
|
<input
|
|
id="password"
|
|
type="password"
|
|
value={password}
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
required
|
|
className="w-full px-4 py-2 bg-surface border border-border rounded-lg text-foreground focus:outline-none focus:ring-2 focus:ring-accent"
|
|
/>
|
|
</div>
|
|
|
|
<div>
|
|
<label htmlFor="confirmPassword" className="block text-sm font-medium text-foreground mb-2">
|
|
Confirm Password
|
|
</label>
|
|
<input
|
|
id="confirmPassword"
|
|
type="password"
|
|
value={confirmPassword}
|
|
onChange={(e) => setConfirmPassword(e.target.value)}
|
|
required
|
|
className="w-full px-4 py-2 bg-surface border border-border rounded-lg text-foreground focus:outline-none focus:ring-2 focus:ring-accent"
|
|
/>
|
|
</div>
|
|
|
|
<button
|
|
type="submit"
|
|
disabled={loading || !token}
|
|
className="w-full bg-accent text-white py-2 px-4 rounded-lg font-semibold hover:opacity-90 disabled:opacity-50"
|
|
>
|
|
{loading ? 'Resetting...' : 'Reset Password'}
|
|
</button>
|
|
</form>
|
|
|
|
<div className="mt-6 text-center">
|
|
<Link href="/login" className="text-accent hover:underline">
|
|
Back to login
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default function ResetPasswordPage() {
|
|
return (
|
|
<Suspense fallback={<div className="min-h-screen bg-background" />}>
|
|
<ResetPasswordContent />
|
|
</Suspense>
|
|
)
|
|
}
|