Disable backup export until passphrases match.
The download button stays inactive until both fields agree and meet the minimum length, so users cannot start export with a mismatch. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -68,6 +68,9 @@ export default function LogbookBackupPanel({ logbookId, onRestored }: LogbookBac
|
|||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
const [success, setSuccess] = useState<string | null>(null)
|
const [success, setSuccess] = useState<string | null>(null)
|
||||||
|
|
||||||
|
const exportPassphrasesMatch =
|
||||||
|
exportPassphrase.length >= 8 && exportPassphrase === exportConfirm
|
||||||
|
|
||||||
const handleExportSubmit = async (e: React.FormEvent) => {
|
const handleExportSubmit = async (e: React.FormEvent) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
await handleExport()
|
await handleExport()
|
||||||
@@ -291,7 +294,7 @@ export default function LogbookBackupPanel({ logbookId, onRestored }: LogbookBac
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="btn primary"
|
className="btn primary"
|
||||||
disabled={exporting || !exportPassphrase || !exportConfirm}
|
disabled={exporting || !exportPassphrasesMatch}
|
||||||
>
|
>
|
||||||
<Download size={16} />
|
<Download size={16} />
|
||||||
{exporting ? t('settings.backup_exporting') : t('settings.backup_export_btn')}
|
{exporting ? t('settings.backup_exporting') : t('settings.backup_export_btn')}
|
||||||
|
|||||||
Reference in New Issue
Block a user