Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

Commit 285c128

Browse files
fix: prevent access to passkey setup if already registered
Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) <aider@aider.chat>
1 parent 02ac3c2 commit 285c128

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

frontend/src/components/PasskeySetupPage.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ const PasskeySetupPage: React.FC = () => {
1616
const navigate = useNavigate();
1717

1818
useEffect(() => {
19+
const isAuthenticated = localStorage.getItem('isAdminAuthenticated') === 'true';
20+
const needsSetup = localStorage.getItem('needsPasskeySetup');
21+
22+
// If user is authenticated and doesn't need to set up a passkey, redirect them.
23+
if (isAuthenticated && !needsSetup) {
24+
navigate('/admin/dashboard');
25+
return;
26+
}
27+
1928
// Check if browser supports passkeys
2029
const checkPasskeySupport = async () => {
2130
try {
@@ -37,7 +46,7 @@ const PasskeySetupPage: React.FC = () => {
3746
};
3847

3948
checkPasskeySupport();
40-
}, []);
49+
}, [navigate]);
4150

4251
const handleRegisterPasskey = async () => {
4352
setError(null);

0 commit comments

Comments
 (0)