Files
bitvid/components/login-modal.html
T

248 lines
8.8 KiB
HTML

<div
id="loginModal"
class="bv-modal hidden items-start justify-center"
role="dialog"
aria-modal="true"
aria-labelledby="loginModalTitle"
aria-describedby="loginModalDescription"
data-ds="new"
>
<div class="bv-modal-backdrop" data-dismiss></div>
<div class="modal-sheet max-h-modal-shell overflow-hidden" tabindex="-1">
<!-- Header with the special exit button (unchanged) -->
<div class="modal-header">
<h2 id="loginModalTitle" class="text-xl font-bold text-text">
Login Options
</h2>
<button
id="closeLoginModal"
class="modal-close"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M6 18L18 6M6 6l12 12"
/>
</svg>
</button>
</div>
<!-- Body with buttons (unchanged) -->
<div id="loginModalDescription" class="modal-body space-y-4 overflow-y-auto">
<!-- Application Form button -->
<button
id="openApplicationModal"
class="btn w-full"
type="button"
>
Application Form
</button>
<!-- Simple horizontal rule -->
<div class="my-2 border-t border-border/60"></div>
<!-- Login provider buttons are rendered dynamically -->
<div data-login-providers class="space-y-3"></div>
<template data-login-provider-template>
<button
class="btn w-full text-left"
type="button"
data-provider-button
>
<span class="flex w-full flex-col items-start gap-2">
<span data-provider-label class="text-base font-semibold"></span>
<span data-provider-description class="text-sm text-text-muted"></span>
<div
data-provider-status-row
class="hidden flex w-full items-center justify-between gap-2 text-sm text-text-muted"
>
<span data-provider-status class="truncate"></span>
<button
type="button"
class="btn-link text-sm hidden"
data-provider-disconnect
>
Disconnect
</button>
</div>
<span
data-provider-capabilities
class="flex flex-wrap gap-2"
></span>
</span>
</button>
</template>
<template data-login-nsec-dialog>
<form
data-nsec-form
class="space-y-4 rounded-xl border border-border bg-overlay-panel-soft px-5 py-4"
>
<div class="space-y-2">
<h3 class="text-lg font-semibold text-text">Direct key login</h3>
<p class="text-sm text-text-muted" data-nsec-warning>
"Unsafe by default" — imported keys stay decrypted only for this session
unless you protect them with a passphrase.
</p>
</div>
<div
data-nsec-error
class="hidden rounded-lg border border-danger/60 bg-danger/10 px-4 py-2 text-sm text-danger"
role="alert"
></div>
<fieldset data-nsec-unlock-section class="space-y-3 hidden">
<legend class="text-sm font-semibold text-text">Unlock saved key</legend>
<label class="inline-flex items-center gap-2 text-sm text-text">
<input
type="radio"
name="nsec-mode"
value="unlock"
class="radio"
data-nsec-mode="unlock"
/>
<span>Use the encrypted key stored on this device</span>
</label>
<div class="space-y-2 pl-6" data-nsec-unlock-fields>
<label class="block text-sm font-medium text-text" for="nsecUnlockPassphrase">
Passphrase
</label>
<input
id="nsecUnlockPassphrase"
type="password"
class="input"
autocomplete="current-password"
data-nsec-unlock-passphrase
required
/>
</div>
</fieldset>
<fieldset data-nsec-import-section class="space-y-3">
<legend class="text-sm font-semibold text-text">Import a new secret</legend>
<label class="inline-flex items-center gap-2 text-sm text-text">
<input
type="radio"
name="nsec-mode"
value="import"
class="radio"
data-nsec-mode="import"
checked
/>
<span>Paste an nsec, hex key, or mnemonic seed</span>
</label>
<div class="space-y-3 pl-6" data-nsec-import-fields>
<label class="block text-sm font-medium text-text" for="nsecSecretInput">
Secret
</label>
<textarea
id="nsecSecretInput"
class="input"
rows="3"
spellcheck="false"
autocomplete="off"
data-nsec-secret
required
></textarea>
<label class="inline-flex items-center gap-2 text-sm text-text">
<input type="checkbox" class="checkbox" data-nsec-remember />
<span>Remember this key on this device</span>
</label>
<div class="space-y-2" data-nsec-passphrase-fields hidden>
<label class="block text-sm font-medium text-text" for="nsecPassphraseInput">
Passphrase
</label>
<input
id="nsecPassphraseInput"
type="password"
class="input"
autocomplete="new-password"
data-nsec-passphrase
/>
<label class="block text-sm font-medium text-text" for="nsecPassphraseConfirm">
Confirm passphrase
</label>
<input
id="nsecPassphraseConfirm"
type="password"
class="input"
autocomplete="new-password"
data-nsec-passphrase-confirm
/>
</div>
</div>
</fieldset>
<div class="flex justify-end gap-2">
<button type="button" class="btn-ghost" data-nsec-cancel>Cancel</button>
<button type="submit" class="btn" data-nsec-submit>Continue</button>
</div>
</form>
</template>
<template data-login-nip46-dialog>
<form
data-nip46-form
class="space-y-4 rounded-xl border border-border bg-overlay-panel-soft px-5 py-4"
>
<div class="space-y-2">
<h3 class="text-lg font-semibold text-text">Connect remote signer</h3>
<p class="text-sm text-text-muted">
Paste the <code>nostrconnect://</code> or <code>bunker://</code> link
from your signer to establish a Nostr Connect session.
</p>
</div>
<div
data-nip46-error
class="hidden rounded-lg border border-danger/60 bg-danger/10 px-4 py-2 text-sm text-danger"
role="alert"
></div>
<div class="space-y-2">
<label
class="block text-sm font-medium text-text"
for="nip46ConnectUri"
>
Connection string
</label>
<textarea
id="nip46ConnectUri"
class="input"
rows="3"
spellcheck="false"
autocomplete="off"
placeholder="nostrconnect://… or bunker://…"
data-nip46-connect-uri
required
></textarea>
<p class="text-xs text-text-muted">
We will connect to the relays embedded in the link and request signing
permissions on your behalf.
</p>
</div>
<div class="space-y-2">
<label class="inline-flex items-center gap-2 text-sm text-text">
<input type="checkbox" class="checkbox" data-nip46-remember checked />
<span>Remember this signer for future logins</span>
</label>
<button
type="button"
class="btn-link text-sm hidden"
data-nip46-reuse
>
Reconnect using the saved session
</button>
</div>
<div class="flex justify-end gap-2">
<button type="button" class="btn-ghost" data-nip46-cancel>Cancel</button>
<button type="submit" class="btn" data-nip46-submit>Connect</button>
</div>
</form>
</template>
</div>
</div>
</div>