swarm-ui link-account forms: keep the sent name, drop secrets, one word for forge
The success line of both link forms read the live text field, so editing the name after a link changed the sentence. The result now carries the name that was sent. The matrix form held the typed token and password after a failed submit, and kept them across a switch of credential mode. It now drops them when the request ends and when the mode changes. The linked-accounts list and the delete dialog said forgejo where the link menu and forms say forge; they now say forge.
This commit is contained in:
parent
8f8217100b
commit
ef156d9d23
1 changed files with 52 additions and 18 deletions
|
|
@ -22,7 +22,7 @@ const LABEL_PATTERN = "[a-z0-9\\-]{1,63}";
|
|||
type SubmitState =
|
||||
| { status: "idle" }
|
||||
| { status: "submitting" }
|
||||
| { status: "done"; url: string }
|
||||
| { status: "done"; label: string; url: string }
|
||||
| { status: "error"; problem: ProblemDetails };
|
||||
|
||||
export function LinkForgeAccountForm({
|
||||
|
|
@ -56,7 +56,9 @@ export function LinkForgeAccountForm({
|
|||
return;
|
||||
}
|
||||
const body = (await r.json().catch(() => ({}))) as { url?: string };
|
||||
setResult({ status: "done", url: body.url ?? url.trim() });
|
||||
// The label is stored with the result, so the success message reads
|
||||
// against what was sent even if the field is edited afterwards.
|
||||
setResult({ status: "done", label, url: body.url ?? url.trim() });
|
||||
// The store holds the token now; nothing here needs it.
|
||||
setToken("");
|
||||
} catch (err) {
|
||||
|
|
@ -114,7 +116,7 @@ export function LinkForgeAccountForm({
|
|||
</form>
|
||||
{result.status === "done" && (
|
||||
<p class="link-matrix-account-result-ok">
|
||||
linked <strong>{label}</strong> ({result.url}) to{" "}
|
||||
linked <strong>{result.label}</strong> ({result.url}) to{" "}
|
||||
<strong>{agent}</strong>
|
||||
</p>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue