Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: tell Safari which account the Studio password belongs to (#11858)

Nilayced17531b046
diff --git a/studio/frontend/src/features/auth/components/auth-form.tsx b/studio/frontend/src/features/auth/components/auth-form.tsx
index d59fc07355e..5ddedd432f5 100644
--- a/studio/frontend/src/features/auth/components/auth-form.tsx
+++ b/studio/frontend/src/features/auth/components/auth-form.tsx
@@ -201,6 +201,10 @@ export function AuthForm({ mode }: AuthFormProps): ReactElement | null {
const hasBootstrapPassword = Boolean(window.__UNSLOTH_BOOTSTRAP__?.password);
const changingFromSetupCode =
!isLoginMode && sessionAccount(getAuthToken())?.isOwner === false;
+ const passwordManagerUsername =
+ isLoginMode && loginMode === "multi"
+ ? null
+ : sessionAccount(getAuthToken())?.username || username || null;
const invalidChangePasswordForm =
!isLoginMode &&
(currentPassword.length < 8 ||
@@ -375,6 +379,18 @@ export function AuthForm({ mode }: AuthFormProps): ReactElement | null {
</p>
)}
<form className="space-y-5" onSubmit={handleSubmit}>
+ {passwordManagerUsername && (
+ <input
+ type="text"
+ name="username"
+ autoComplete="username"
+ value={passwordManagerUsername}
+ readOnly
+ tabIndex={-1}
+ aria-hidden="true"
+ className="sr-only"
+ />
+ )}
{isLoginMode && loginMode === "multi" && (
<div className="space-y-2">
<Label htmlFor="username">Username</Label>
diff --git a/studio/frontend/tests/login-account-modes.test.ts b/studio/frontend/tests/login-account-modes.test.ts
index 6a9969ea3b3..3cfd00a4d21 100644
--- a/studio/frontend/tests/login-account-modes.test.ts
+++ b/studio/frontend/tests/login-account-modes.test.ts
@@ -209,6 +209,14 @@ for (const mode of ["single", "multi"] as const) {
);
assert.equal(Boolean(username), mode === "multi");
if (username) assert.equal(username.props.autoComplete, "username");
+ const savedUsernames = elements(tree).filter(
+ (element) => element.props.autoComplete === "username",
+ );
+ assert.equal(savedUsernames.length, 1);
+ if (mode === "single") {
+ assert.equal(savedUsernames[0].props.value, "unsloth");
+ assert.equal(savedUsernames[0].props.readOnly, true);
+ }
const password = elements(tree).find(
(element) => element.props.id === "password",
);
@@ -221,6 +229,25 @@ for (const mode of ["single", "multi"] as const) {
});
}
+for (const mode of ["single", "multi"] as const) {
+ test(`${mode} change password form names the account for password managers`, async (t) => {
+ environment(t);
+ globalThis.fetch = async () =>
+ Response.json({
+ initialized: true,
+ requires_password_change: true,
+ login_mode: mode,
+ });
+ const form = mountForm(client(), { access: "access", change: true });
+ const tree = await form.initialize("change-password");
+ const savedUsernames = elements(tree).filter(
+ (element) => element.props.autoComplete === "username",
+ );
+ assert.equal(savedUsernames.length, 1);
+ assert.equal(savedUsernames[0].props.value, "alice");
+ });
+}
+
test("single mode still posts unsloth and does not refetch on success", async (t) => {
environment(t);
const requests: unknown[] = [];