docs: explain admin import password logic
This commit is contained in:
@@ -107,6 +107,7 @@ export function AdminSettings({
|
|||||||
const [showPasswordInput, setShowPasswordInput] = React.useState(false);
|
const [showPasswordInput, setShowPasswordInput] = React.useState(false);
|
||||||
const [importPassword, setImportPassword] = React.useState("");
|
const [importPassword, setImportPassword] = React.useState("");
|
||||||
|
|
||||||
|
// Only local accounts need to confirm their password before we post the import request.
|
||||||
const requiresImportPassword = React.useMemo(
|
const requiresImportPassword = React.useMemo(
|
||||||
() => !currentUser?.is_oidc,
|
() => !currentUser?.is_oidc,
|
||||||
[currentUser?.is_oidc],
|
[currentUser?.is_oidc],
|
||||||
@@ -129,6 +130,7 @@ export function AdminSettings({
|
|||||||
toast.error(t("admin.failedToFetchOidcConfig"));
|
toast.error(t("admin.failedToFetchOidcConfig"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Capture the current session so we know whether to ask for a password later.
|
||||||
getUserInfo()
|
getUserInfo()
|
||||||
.then((info) => {
|
.then((info) => {
|
||||||
if (info) {
|
if (info) {
|
||||||
@@ -386,6 +388,7 @@ export function AdminSettings({
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("file", importFile);
|
formData.append("file", importFile);
|
||||||
if (requiresImportPassword) {
|
if (requiresImportPassword) {
|
||||||
|
// Preserve the existing password flow for non-OIDC accounts.
|
||||||
formData.append("password", importPassword);
|
formData.append("password", importPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -996,6 +999,7 @@ export function AdminSettings({
|
|||||||
</span>
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
{/* Only render the password field when a local account is performing the import. */}
|
||||||
{importFile && requiresImportPassword && (
|
{importFile && requiresImportPassword && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="import-password">Password</Label>
|
<Label htmlFor="import-password">Password</Label>
|
||||||
|
|||||||
Reference in New Issue
Block a user