mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-18 14:55:22 +00:00
Temp credential storage
This commit is contained in:
@@ -62,13 +62,23 @@ export default function RdpClient({
|
|||||||
target: Target | null;
|
target: Target | null;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
}) {
|
}) {
|
||||||
const [form, setForm] = useState<FormState>({
|
const STORAGE_KEY = "pangolin_rdp_credentials";
|
||||||
username: "",
|
|
||||||
password: "",
|
const [form, setForm] = useState<FormState>(() => {
|
||||||
domain: "",
|
try {
|
||||||
kdcProxyUrl: "",
|
const saved = localStorage.getItem(STORAGE_KEY);
|
||||||
pcb: "",
|
if (saved) return JSON.parse(saved) as FormState;
|
||||||
enableClipboard: true
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
username: "",
|
||||||
|
password: "",
|
||||||
|
domain: "",
|
||||||
|
kdcProxyUrl: "",
|
||||||
|
pcb: "",
|
||||||
|
enableClipboard: true
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const [showLogin, setShowLogin] = useState(true);
|
const [showLogin, setShowLogin] = useState(true);
|
||||||
@@ -255,6 +265,11 @@ export default function RdpClient({
|
|||||||
try {
|
try {
|
||||||
const sessionInfo = await userInteraction.connect(builder.build());
|
const sessionInfo = await userInteraction.connect(builder.build());
|
||||||
|
|
||||||
|
try {
|
||||||
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(form));
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
setConnecting(false);
|
setConnecting(false);
|
||||||
setShowLogin(false);
|
setShowLogin(false);
|
||||||
userInteraction.setVisibility(true);
|
userInteraction.setVisibility(true);
|
||||||
|
|||||||
@@ -26,10 +26,16 @@ export default function SshClient({
|
|||||||
target: Target | null;
|
target: Target | null;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
}) {
|
}) {
|
||||||
const [form, setForm] = useState<FormState>({
|
const STORAGE_KEY = "pangolin_ssh_credentials";
|
||||||
username: "",
|
|
||||||
password: "",
|
const [form, setForm] = useState<FormState>(() => {
|
||||||
privateKey: ""
|
try {
|
||||||
|
const saved = localStorage.getItem(STORAGE_KEY);
|
||||||
|
if (saved) return JSON.parse(saved) as FormState;
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return { username: "", password: "", privateKey: "" };
|
||||||
});
|
});
|
||||||
|
|
||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
@@ -172,6 +178,11 @@ export default function SshClient({
|
|||||||
privateKey: form.privateKey
|
privateKey: form.privateKey
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
try {
|
||||||
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(form));
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
setConnecting(false);
|
setConnecting(false);
|
||||||
setConnected(true);
|
setConnected(true);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,8 +23,16 @@ export default function VncClient({
|
|||||||
target: Target | null;
|
target: Target | null;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
}) {
|
}) {
|
||||||
const [form, setForm] = useState<FormState>({
|
const STORAGE_KEY = "pangolin_vnc_credentials";
|
||||||
password: ""
|
|
||||||
|
const [form, setForm] = useState<FormState>(() => {
|
||||||
|
try {
|
||||||
|
const saved = localStorage.getItem(STORAGE_KEY);
|
||||||
|
if (saved) return JSON.parse(saved) as FormState;
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return { password: "" };
|
||||||
});
|
});
|
||||||
|
|
||||||
const [connected, setConnected] = useState(false);
|
const [connected, setConnected] = useState(false);
|
||||||
@@ -111,6 +119,11 @@ export default function VncClient({
|
|||||||
rfb.resizeSession = true;
|
rfb.resizeSession = true;
|
||||||
|
|
||||||
rfb.addEventListener("connect", () => {
|
rfb.addEventListener("connect", () => {
|
||||||
|
try {
|
||||||
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(form));
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
setConnected(true);
|
setConnected(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user