diff --git a/frontend/src/components/PanicListener.tsx b/frontend/src/components/PanicListener.tsx index 80564ea..706eccf 100644 --- a/frontend/src/components/PanicListener.tsx +++ b/frontend/src/components/PanicListener.tsx @@ -143,8 +143,8 @@ const PanicListener: React.FC = ({ onPanic }) => { if (currentKeys.length !== shortcut.length) return; // Sort and compare - const normalizedPressed = currentKeys.map(k => k.toLowerCase()).sort(); - const normalizedShortcut = shortcut.map(k => k.toLowerCase()).sort(); + const normalizedPressed = (currentKeys ?? []).map(k => k.toLowerCase()).sort((a, b) => a - b); + const normalizedShortcut = (shortcut ?? []).map(k => k.toLowerCase()).sort(); const matches = normalizedPressed.every((key, index) => key === normalizedShortcut[index]); diff --git a/frontend/src/pages/OrganizationPage.tsx b/frontend/src/pages/OrganizationPage.tsx index 9f72d30..660710e 100644 --- a/frontend/src/pages/OrganizationPage.tsx +++ b/frontend/src/pages/OrganizationPage.tsx @@ -14,7 +14,7 @@ const OrganizationPage: React.FC = () => { // Create a placeholder organization object // ProfileManager will fetch actual data const organization: Organization = { - id: parseInt(id || '0'), + id: parseInt(id || '0', 10), category: categoryId, name: '', // Will be loaded by ProfileManager logo_url: null, diff --git a/frontend/src/services/securityService.ts b/frontend/src/services/securityService.ts index 3cd05a8..58ee193 100644 --- a/frontend/src/services/securityService.ts +++ b/frontend/src/services/securityService.ts @@ -87,7 +87,7 @@ export const updatePasswordHash = async ( const msgBuffer = new TextEncoder().encode(password); const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer); const hashArray = Array.from(new Uint8Array(hashBuffer)); - const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); + const hashHex = (hashArray ?? []).map(b => b.toString(16).padStart(2, '0')).join(''); await apiClient.post(`/security/profiles/${profileId}/hash/`, { password_hash: hashHex @@ -113,7 +113,7 @@ async function sha1(message: string): Promise { const msgBuffer = new TextEncoder().encode(message); const hashBuffer = await crypto.subtle.digest('SHA-1', msgBuffer); const hashArray = Array.from(new Uint8Array(hashBuffer)); - const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); + const hashHex = (hashArray ?? []).map(b => b.toString(16).padStart(2, '0')).join(''); return hashHex.toUpperCase(); } @@ -244,7 +244,7 @@ export const FORBIDDEN_SHORTCUTS: string[][] = [ * Check if a key combination is a forbidden browser shortcut */ export function isForbiddenShortcut(keys: string[]): boolean { - const normalizedKeys = keys.map(k => k.toLowerCase()).sort(); + const normalizedKeys = keys.map(k => k.toLowerCase()).sort((a, b) => a - b); return FORBIDDEN_SHORTCUTS.some(forbidden => { const normalizedForbidden = forbidden.map(k => k.toLowerCase()).sort();