2024-11-09 20:06:54 +01:00
|
|
|
import handleCopy from "@/components/handleCopy";
|
2024-11-04 23:55:08 +01:00
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import { Separator } from "@/components/ui/separator";
|
|
|
|
|
import { Script } from "@/lib/types";
|
|
|
|
|
|
|
|
|
|
export default function DefaultPassword({ item }: { item: Script }) {
|
2024-11-09 20:06:54 +01:00
|
|
|
const hasDefaultLogin =
|
|
|
|
|
item.default_credentials.username && item.default_credentials.password;
|
2024-11-04 23:55:08 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
{hasDefaultLogin && (
|
|
|
|
|
<div className="mt-4 rounded-lg border bg-accent/50">
|
|
|
|
|
<div className="flex gap-3 px-4 py-2">
|
|
|
|
|
<h2 className="text-lg font-semibold">Default Login Credentials</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<Separator className="w-full"></Separator>
|
|
|
|
|
<div className="flex flex-col gap-2 p-4">
|
|
|
|
|
<p className="mb-2 text-sm">
|
|
|
|
|
You can use the following credentials to login to the {""}
|
2024-11-06 23:47:04 +01:00
|
|
|
{item.name} {item.type}.
|
2024-11-04 23:55:08 +01:00
|
|
|
</p>
|
|
|
|
|
<div className="text-sm">
|
|
|
|
|
Username:{" "}
|
|
|
|
|
<Button
|
|
|
|
|
variant={"secondary"}
|
|
|
|
|
size={"null"}
|
|
|
|
|
onClick={() =>
|
2024-11-09 20:06:54 +01:00
|
|
|
handleCopy(
|
|
|
|
|
"username",
|
|
|
|
|
item.default_credentials.username ?? "",
|
|
|
|
|
)
|
2024-11-04 23:55:08 +01:00
|
|
|
}
|
|
|
|
|
>
|
2024-11-06 23:47:04 +01:00
|
|
|
{item.default_credentials.username}
|
2024-11-04 23:55:08 +01:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="text-sm">
|
|
|
|
|
Password:{" "}
|
|
|
|
|
<Button
|
|
|
|
|
variant={"secondary"}
|
|
|
|
|
size={"null"}
|
|
|
|
|
onClick={() =>
|
2024-11-09 20:06:54 +01:00
|
|
|
handleCopy(
|
|
|
|
|
"password",
|
|
|
|
|
item.default_credentials.password ?? "",
|
|
|
|
|
)
|
2024-11-04 23:55:08 +01:00
|
|
|
}
|
|
|
|
|
>
|
2024-11-06 23:47:04 +01:00
|
|
|
{item.default_credentials.password}
|
2024-11-04 23:55:08 +01:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|