mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-08 15:14:52 +02:00
Prompt for the username on vnc
This commit is contained in:
+2
-1
@@ -3587,7 +3587,8 @@
|
|||||||
"sshPrivateKeyPlaceholder": "-----BEGIN OPENSSH PRIVATE KEY-----",
|
"sshPrivateKeyPlaceholder": "-----BEGIN OPENSSH PRIVATE KEY-----",
|
||||||
"sshPrivateKeyRequired": "Private key is required",
|
"sshPrivateKeyRequired": "Private key is required",
|
||||||
"vncTitle": "VNC",
|
"vncTitle": "VNC",
|
||||||
"vncSignInDescription": "Enter your VNC password to connect",
|
"vncSignInDescription": "Enter your VNC credentials to connect",
|
||||||
|
"vncUsernameOptional": "Username (optional)",
|
||||||
"vncPasswordOptional": "Password (optional)",
|
"vncPasswordOptional": "Password (optional)",
|
||||||
"vncNoResourceTarget": "No resource target is available",
|
"vncNoResourceTarget": "No resource target is available",
|
||||||
"vncFailedToLoadNovnc": "Failed to load noVNC",
|
"vncFailedToLoadNovnc": "Failed to load noVNC",
|
||||||
|
|||||||
@@ -37,10 +37,12 @@ import { createApiClient } from "@app/lib/api";
|
|||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
|
|
||||||
type VncCredentialsForm = {
|
type VncCredentialsForm = {
|
||||||
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_VNC_CREDENTIALS: VncCredentialsForm = {
|
const DEFAULT_VNC_CREDENTIALS: VncCredentialsForm = {
|
||||||
|
username: "",
|
||||||
password: ""
|
password: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,6 +61,7 @@ export default function VncClient({
|
|||||||
const resourceName = target?.name?.trim() || null;
|
const resourceName = target?.name?.trim() || null;
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
|
username: z.string(),
|
||||||
password: z.string()
|
password: z.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -168,8 +171,11 @@ export default function VncClient({
|
|||||||
screenRef.current.innerHTML = "";
|
screenRef.current.innerHTML = "";
|
||||||
|
|
||||||
const options: Record<string, unknown> = {};
|
const options: Record<string, unknown> = {};
|
||||||
if (values.password) {
|
if (values.username || values.password) {
|
||||||
options.credentials = { password: values.password };
|
options.credentials = {
|
||||||
|
username: values.username,
|
||||||
|
password: values.password
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let rfb: any;
|
let rfb: any;
|
||||||
@@ -292,6 +298,25 @@ export default function VncClient({
|
|||||||
onSubmit={form.handleSubmit(onSubmit)}
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
className="space-y-4"
|
className="space-y-4"
|
||||||
>
|
>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="username"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>
|
||||||
|
{t("vncUsernameOptional")}
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
autoComplete="username"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="password"
|
name="password"
|
||||||
|
|||||||
Reference in New Issue
Block a user