remove account when no password
This commit is contained in:
parent
69b66e715e
commit
8d85426f0e
@ -21,6 +21,9 @@ export function HandleAccountNotReady({
|
|||||||
if (officer.state === "locked") {
|
if (officer.state === "locked") {
|
||||||
return (
|
return (
|
||||||
<UnlockAccount
|
<UnlockAccount
|
||||||
|
onRemoveAccount={() => {
|
||||||
|
officer.forget();
|
||||||
|
}}
|
||||||
onAccountUnlocked={(pwd) => {
|
onAccountUnlocked={(pwd) => {
|
||||||
officer.tryUnlock(pwd);
|
officer.tryUnlock(pwd);
|
||||||
}}
|
}}
|
||||||
|
@ -6,8 +6,10 @@ import { createNewForm } from "../handlers/forms.js";
|
|||||||
|
|
||||||
export function UnlockAccount({
|
export function UnlockAccount({
|
||||||
onAccountUnlocked,
|
onAccountUnlocked,
|
||||||
|
onRemoveAccount,
|
||||||
}: {
|
}: {
|
||||||
onAccountUnlocked: (password: string) => void;
|
onAccountUnlocked: (password: string) => void;
|
||||||
|
onRemoveAccount: () => void;
|
||||||
}): VNode {
|
}): VNode {
|
||||||
const Form = createNewForm<{
|
const Form = createNewForm<{
|
||||||
password: string;
|
password: string;
|
||||||
@ -64,6 +66,15 @@ export function UnlockAccount({
|
|||||||
</div>
|
</div>
|
||||||
</Form.Provider>
|
</Form.Provider>
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
onRemoveAccount();
|
||||||
|
}}
|
||||||
|
class="m-4 block rounded-md bg-red-600 px-3 py-2 text-center text-sm text-white shadow-sm hover:bg-red-500 "
|
||||||
|
>
|
||||||
|
Remove account
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -43,8 +43,7 @@ export function buildStorageKey<Key = string>(
|
|||||||
return {
|
return {
|
||||||
id: name,
|
id: name,
|
||||||
codec: codec ?? (codecForString() as Codec<Key>),
|
codec: codec ?? (codecForString() as Codec<Key>),
|
||||||
[opaque_StorageKey]: true,
|
} as StorageKey<Key>;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StorageState<Type = string> {
|
export interface StorageState<Type = string> {
|
||||||
|
Loading…
Reference in New Issue
Block a user