fix(studio): show Windows-specific reset-password command on login error (#4529)
This commit is contained in:
parent
5916bcb2e3
commit
1129ea44bc
1 changed files with 9 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ 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
|
||||
|
|
@ -278,7 +279,14 @@ export function AuthForm({ mode }: AuthFormProps): ReactElement | null {
|
|||
);
|
||||
navigate({ to: getPostAuthRoute() });
|
||||
} catch (err: unknown) {
|
||||
setError(err instanceof Error ? err.message : "Auth failed.");
|
||||
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",
|
||||
);
|
||||
}
|
||||
setError(msg);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue