mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-31 01:42:27 +00:00
Fix login modal nsec error visibility
- Removed `required` attribute from nsec secret input in `components/login-modal.html` to prevent browser native validation from suppressing custom error UI.
- Updated `js/ui/loginModalController.js` to ensure `required` property is disabled in JavaScript logic.
- Added comprehensive unit tests in `tests/login-modal-controller.test.mjs` to verify:
- Custom error message is shown on empty submission.
- Required attributes remain disabled when toggling between unlock/import modes.
- NIP-46 handshake panel is correctly displayed (regression check).
- Verified fix with existing E2E test `tests/e2e/ui-modals.spec.ts` (NSEC error assertion passes).
This commit is contained in:
1 parent
3a556f2597
commit
8bbe3f623d
3 files changed
+278
-5
No files matched your search
@@ -937,14 +937,14 @@ export default class LoginModalController {
|
||||
passphraseFields.hidden = !shouldShow;
|
||||
if (passphraseInput instanceof HTMLInputElement) {
|
||||
passphraseInput.disabled = !shouldShow;
|
||||
passphraseInput.required = shouldShow;
|
||||
passphraseInput.required = false;
|
||||
if (!shouldShow) {
|
||||
passphraseInput.value = "";
|
||||
}
|
||||
}
|
||||
if (passphraseConfirm instanceof HTMLInputElement) {
|
||||
passphraseConfirm.disabled = !shouldShow;
|
||||
passphraseConfirm.required = shouldShow;
|
||||
passphraseConfirm.required = false;
|
||||
if (!shouldShow) {
|
||||
passphraseConfirm.value = "";
|
||||
}
|
||||
@@ -959,14 +959,14 @@ export default class LoginModalController {
|
||||
}
|
||||
if (unlockPassphrase instanceof HTMLInputElement) {
|
||||
unlockPassphrase.disabled = !usingUnlock;
|
||||
unlockPassphrase.required = usingUnlock;
|
||||
unlockPassphrase.required = false;
|
||||
if (!usingUnlock) {
|
||||
unlockPassphrase.value = "";
|
||||
}
|
||||
}
|
||||
if (secretField instanceof HTMLTextAreaElement) {
|
||||
secretField.disabled = usingUnlock;
|
||||
secretField.required = !usingUnlock;
|
||||
secretField.required = false;
|
||||
if (usingUnlock) {
|
||||
secretField.value = "";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user