feat(setup): center onboarding and add secure token help
This commit is contained in:
@@ -4,6 +4,7 @@ import { useEffect, useState, type FormEvent } from "react";
|
||||
import { apiUrl, requestJson } from "../lib/api-client";
|
||||
import { authFetch, ForbiddenError, logout, setToken, UnauthorizedError } from "../lib/auth";
|
||||
import MagentMark from "../ui/MagentMark";
|
||||
import SetupTokenHelp from "./SetupTokenHelp";
|
||||
import { serviceStatusLabel } from "../admin/configNavigation";
|
||||
import {
|
||||
ALL_FIELDS,
|
||||
@@ -352,7 +353,7 @@ export default function SetupPage() {
|
||||
Retry
|
||||
</button>
|
||||
) : forbidden ? (
|
||||
<section className={styles.panel}>
|
||||
<section className={`${styles.panel} ${styles.accountPanel}`}>
|
||||
<h2>Administrator access required</h2>
|
||||
<p>Ask an administrator to finish installation.</p>
|
||||
<button type="button" disabled={!!busy} onClick={switchAccount}>
|
||||
@@ -360,19 +361,12 @@ export default function SetupPage() {
|
||||
</button>
|
||||
</section>
|
||||
) : !admin ? (
|
||||
<section className={styles.panel}>
|
||||
<section className={`${styles.panel} ${styles.accountPanel}`}>
|
||||
<h2>{status.needs_admin ? "Create your administrator" : "Sign in to continue"}</h2>
|
||||
<p>
|
||||
{status.needs_admin ? (
|
||||
<>
|
||||
Enter the SETUP_TOKEN from your deployment environment. For a managed Portainer install, open the
|
||||
Magent container console and run <code>python -m app.container_bootstrap setup-token</code> to
|
||||
retrieve it. Only the server operator can create the first administrator; the console command stops
|
||||
returning the token after that account exists.
|
||||
</>
|
||||
) : (
|
||||
"Use your local Magent administrator account. Settings are never available to unauthenticated visitors."
|
||||
)}
|
||||
{status.needs_admin
|
||||
? "Use your private setup token to create the first administrator account."
|
||||
: "Use your local Magent administrator account. Settings are never available to unauthenticated visitors."}
|
||||
</p>
|
||||
<form onSubmit={authenticate} className={styles.account}>
|
||||
{status.needs_admin && (
|
||||
@@ -409,8 +403,11 @@ export default function SetupPage() {
|
||||
maxLength={1024}
|
||||
value={setupToken}
|
||||
onChange={(event) => setSetupToken(event.target.value)}
|
||||
aria-describedby="setup-token-hint"
|
||||
disabled={!!busy}
|
||||
/>
|
||||
<p id="setup-token-hint">Retrieve this token from your server console.</p>
|
||||
<SetupTokenHelp disabled={!!busy} />
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.field}>
|
||||
|
||||
Reference in New Issue
Block a user