Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/components/PanicListener.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ const PanicListener: React.FC<PanicListenerProps> = ({ 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]);

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/OrganizationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/services/securityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -113,7 +113,7 @@ async function sha1(message: string): Promise<string> {
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();
}

Expand Down Expand Up @@ -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();
Expand Down