From c8be6f6af7e6966852f76acabe1ffbd338b22d5a Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 3 Jun 2026 05:21:30 -0700 Subject: [PATCH] fix(studio): show working reset-password command on Windows login error The backend's "incorrect password" error already returns the correct, PATH-based command ("unsloth studio reset-password"), which the installer puts on PATH on every platform. The auth form rewrote it on Windows into a relative path: .\unsloth_studio\Scripts\unsloth.exe studio reset-password That only resolves when the terminal happens to be inside the Studio home dir (~\.unsloth\studio). From any normal working directory (e.g. C:\Users\) it fails with CommandNotFoundException, so users could not follow the hint to recover a forgotten password. Remove the Windows-only rewrite (and its now-unused usePlatformStore import) and display the backend's command as-is. Frontend typecheck passes (the one remaining tsc error, @tauri-apps/plugin-window-state in provider.tsx, is a pre-existing desktop-only module-resolution issue unrelated to this change). Co-Authored-By: Claude Opus 4.8 --- .../src/features/auth/components/auth-form.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/studio/frontend/src/features/auth/components/auth-form.tsx b/studio/frontend/src/features/auth/components/auth-form.tsx index d753e1aab5..c1606c7020 100644 --- a/studio/frontend/src/features/auth/components/auth-form.tsx +++ b/studio/frontend/src/features/auth/components/auth-form.tsx @@ -10,7 +10,6 @@ import { Eye, EyeOff } from "lucide-react"; import { useEffect, useState } from "react"; import type { ReactElement } from "react"; import type { SyntheticEvent } from "react"; -import { usePlatformStore } from "@/config/env"; import { refreshSession } from "../api"; // Bootstrap credentials injected into index.html by the backend @@ -294,13 +293,13 @@ export function AuthForm({ mode }: AuthFormProps): ReactElement | null { storeAuthTokens(token.access_token, token.refresh_token); navigate({ to: getPostAuthRoute() }); } catch (err: unknown) { - let msg = err instanceof Error ? err.message : "Auth failed."; - if (msg.includes("unsloth studio reset-password") && usePlatformStore.getState().deviceType === "windows") { - msg = msg.replace( - "unsloth studio reset-password", - ".\\unsloth_studio\\Scripts\\unsloth.exe studio reset-password", - ); - } + // The backend already returns the correct, PATH-based command + // ("unsloth studio reset-password"), which the installer puts on PATH on + // every platform. Do NOT rewrite it to a relative Windows path like + // ".\unsloth_studio\Scripts\unsloth.exe ..." -- that only resolves when the + // terminal happens to be inside the Studio home dir, so it fails with + // CommandNotFoundException everywhere else. Show the backend message as-is. + const msg = err instanceof Error ? err.message : "Auth failed."; setError(msg); } finally { setLoading(false);