Skip to content

Commit 87f6c9e

Browse files
authored
Display default password even if there isn't a default username (#4900)
This fixes the display of the Deluge script.
1 parent 6239075 commit 87f6c9e

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

frontend/src/app/scripts/_components/ScriptItems/DefaultPassword.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Script } from "@/lib/types";
55

66
export default function DefaultPassword({ item }: { item: Script }) {
77
const { username, password } = item.default_credentials;
8-
const hasDefaultLogin = username && password;
8+
const hasDefaultLogin = username || password;
99

1010
if (!hasDefaultLogin) return null;
1111

@@ -23,14 +23,17 @@ export default function DefaultPassword({ item }: { item: Script }) {
2323
<p className="mb-2 text-sm">
2424
You can use the following credentials to login to the {item.name} {item.type}.
2525
</p>
26-
{["username", "password"].map((type) => (
27-
<div key={type} className="text-sm">
28-
{type.charAt(0).toUpperCase() + type.slice(1)}:{" "}
29-
<Button variant="secondary" size="null" onClick={() => copyCredential(type as "username" | "password")}>
30-
{item.default_credentials[type as "username" | "password"]}
31-
</Button>
32-
</div>
33-
))}
26+
{["username", "password"].map((type) => {
27+
const value = item.default_credentials[type as "username" | "password"];
28+
return value && value.trim() !== "" ? (
29+
<div key={type} className="text-sm">
30+
{type.charAt(0).toUpperCase() + type.slice(1)}:{" "}
31+
<Button variant="secondary" size="null" onClick={() => copyCredential(type as "username" | "password")}>
32+
{value}
33+
</Button>
34+
</div>
35+
) : null;
36+
})}
3437
</div>
3538
</div>
3639
);

0 commit comments

Comments
 (0)