Security fixes: swarm signature verification and error handling
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
'use client';
|
||||
|
||||
import { useAuth } from '@/lib/contexts/AuthContext';
|
||||
import { IdentityLockScreen } from '@/components/IdentityLockScreen';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
|
||||
export default function SettingsLayout({ children }: { children: React.ReactNode }) {
|
||||
const { isIdentityUnlocked, loading } = useAuth();
|
||||
const { isIdentityUnlocked, isRestoring, loading } = useAuth();
|
||||
|
||||
if (loading) {
|
||||
// Show loading while restoring or initial load
|
||||
if (loading || isRestoring) {
|
||||
return (
|
||||
<div style={{
|
||||
minHeight: '60vh',
|
||||
@@ -21,12 +21,33 @@ export default function SettingsLayout({ children }: { children: React.ReactNode
|
||||
);
|
||||
}
|
||||
|
||||
// If not unlocked after restoration, user needs to re-login
|
||||
// (This is rare - only happens if browser was closed or session expired)
|
||||
if (!isIdentityUnlocked) {
|
||||
return (
|
||||
<IdentityLockScreen
|
||||
title="Settings Locked"
|
||||
description="To view or change your settings, you must unlock your identity. Your private keys are required to sign any changes you make."
|
||||
/>
|
||||
<div style={{
|
||||
minHeight: '60vh',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: '16px',
|
||||
padding: '24px',
|
||||
textAlign: 'center'
|
||||
}}>
|
||||
<h2 style={{ fontSize: '20px', fontWeight: 600 }}>
|
||||
Session Expired
|
||||
</h2>
|
||||
<p style={{ color: 'var(--foreground-secondary)', maxWidth: '400px' }}>
|
||||
Your session has expired. Please log out and log back in to access settings.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => window.location.href = '/login'}
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Go to Login
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user