Make Authentik users from Apps → Authentik, with a one-time recovery link
An administrator can make a user (user name, name, optional email, groups) and gets a recovery link to send them, so they choose their own password; no password is set or seen here. Uses a separate optional "Token for making users" on the Authentik integration; reading never uses it, and it can be removed again from the page. The link is shown once and never stored or audited; the audit log records who made which user and link. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9ca83994fb
commit
aa95d6b314
13 files changed
+892
-18
No files matched your search
+15
-10
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { api, type AuthentikInfo } from "../api/client";
|
||||
import { api, type AuthentikInfo, type CurrentUser } from "../api/client";
|
||||
import AuthentikNewUser from "../components/AuthentikNewUser";
|
||||
import EmptyState from "../components/EmptyState";
|
||||
import TimeAgo from "../components/TimeAgo";
|
||||
import { BlockSkeleton } from "../components/Skeleton";
|
||||
@@ -22,7 +23,7 @@ function Left({ days, warn, critical }: { days: number; warn: number; critical:
|
||||
return <span className={days <= critical ? "text-red" : days <= warn ? "text-yellow" : "text-secondary"}>{text}</span>;
|
||||
}
|
||||
|
||||
function Card({ a }: { a: AuthentikInfo }) {
|
||||
function Card({ a, isAdmin, onChanged }: { a: AuthentikInfo; isAdmin: boolean; onChanged: () => void }) {
|
||||
const s = a.state;
|
||||
return (
|
||||
<div className="card mb-3">
|
||||
@@ -126,34 +127,38 @@ function Card({ a }: { a: AuthentikInfo }) {
|
||||
{s.lastConfigError && <div className="text-secondary small">Latest configuration error: {s.lastConfigError}</div>}
|
||||
</>
|
||||
)}
|
||||
{isAdmin && a.enabled && <AuthentikNewUser a={a} onChanged={onChanged} />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Authentik, the front door: whether its outposts are reporting, what is about to run out, whether a worker is connected, and who is failing to sign in. */
|
||||
export default function Authentik() {
|
||||
export default function Authentik({ user }: { user: CurrentUser }) {
|
||||
const [data, setData] = useState<AuthentikInfo[] | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
const load = () =>
|
||||
const load = useCallback(
|
||||
() =>
|
||||
api.authentik
|
||||
.list()
|
||||
.then((r) => {
|
||||
setData(r.authentiks);
|
||||
setError(null);
|
||||
})
|
||||
.catch((err) => setError(readableError(err)));
|
||||
.catch((err) => setError(readableError(err))),
|
||||
[],
|
||||
);
|
||||
useEffect(() => {
|
||||
void load();
|
||||
const t = setInterval(load, 60_000);
|
||||
return () => clearInterval(t);
|
||||
}, []);
|
||||
}, [load]);
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title">Authentik</h2>
|
||||
<p className="text-secondary">
|
||||
The sign-in in front of everything else. It is read every few minutes with an API token (see <Link to="/integrations">Integrations</Link>). An <strong>outpost that goes quiet</strong> (the apps it guards stop letting anyone in), a <strong>certificate</strong> or an{" "}
|
||||
<strong>API token</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
|
||||
<strong>API token</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">Alerts</Link>.{user.role === "admin" && " An administrator can also make a user here, with a one-time link for them to choose a password."}
|
||||
</p>
|
||||
<ErrorNotice error={error} />
|
||||
{!data && !error && <BlockSkeleton lines={4} />}
|
||||
@@ -164,7 +169,7 @@ export default function Authentik() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{data?.map((a) => <Card key={a.id} a={a} />)}
|
||||
{data?.map((a) => <Card key={a.id} a={a} isAdmin={user.role === "admin"} onChanged={() => void load()} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user