import React, { useState } from 'react'; import { Box, Button, Text, config } from 'folds'; import { removeFallbackSession } from '../state/sessions'; import type { KeychainBootResult } from '../state/keychainSession'; import type { KeychainInvoke } from '../state/keychainMirror'; /** * [Gitea #105] Shown instead of the app when the desktop app's sign-in is kept * in the OS keychain but couldn't be read this time. Never a silent logout: * Retry boots again; signing in again is an explicit choice. */ export function KeychainUnavailable({ boot, invoke, }: { boot: KeychainBootResult; invoke: KeychainInvoke | undefined; }) { const [busy, setBusy] = useState(false); const missing = boot.mode === 'missing'; const signInAgain = async () => { setBusy(true); removeFallbackSession(); await invoke?.('secure_session_clear').catch(() => undefined); window.location.reload(); }; return ( Couldn't read your sign-in {missing ? 'Lotus Chat keeps your sign-in in Windows Credential Manager, but the entry is missing. If you removed it, sign in again.' : 'Lotus Chat keeps your sign-in in Windows Credential Manager and couldn’t read it just now. This is usually temporary.'} {boot.mode === 'error' && ( {boot.error} )} ); }