Auth with passwords + Playwright E2E tests + PostHog analytics

- bcrypt password hashing in auth (register, login, change-password)
- Login/register pages with password fields
- Profile update + OAuth placeholder endpoints
- Playwright test suite: auth, pages, API (3 test files)
- PostHog Docker analytics on :8010

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 14:26:51 +00:00
parent b4b8439f80
commit dd995d9c0f
13 changed files with 439 additions and 16 deletions

View File

@@ -9,6 +9,8 @@ import { useTranslation } from "@/lib/i18n";
export default function LoginPage() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [showPassword, setShowPassword] = useState(false);
const [loading, setLoading] = useState(false);
const [error, setError] = useState("");
const { setAuth } = useAuth();
@@ -24,7 +26,7 @@ export default function LoginPage() {
setLoading(true);
setError("");
try {
const result = await login({ email: email.trim() });
const result = await login({ email: email.trim(), password: password || undefined });
setAuth(result.data.token, result.data.user);
router.push("/tasks");
} catch (err) {
@@ -60,6 +62,28 @@ export default function LoginPage() {
/>
</div>
<div>
<label className="block text-sm font-medium mb-1">{t("auth.password")}</label>
<div className="relative">
<input
type={showPassword ? "text" : "password"}
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full px-3 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none pr-10"
placeholder="******"
autoComplete="current-password"
/>
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 text-sm"
tabIndex={-1}
>
{showPassword ? t("auth.hidePassword") : t("auth.showPassword")}
</button>
</div>
</div>
<button
type="submit"
disabled={loading}
@@ -69,6 +93,12 @@ export default function LoginPage() {
</button>
</form>
<div className="mt-4 text-center">
<Link href="/forgot-password" className="text-sm text-blue-600 hover:underline">
{t("auth.forgotPassword")}
</Link>
</div>
<p className="text-center text-sm text-muted mt-4">
{t("auth.noAccount")}{" "}
<Link href="/register" className="text-blue-600 hover:underline">