File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
frontend/src/app/scripts/_components/ScriptItems Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { Script } from "@/lib/types";
55
66export 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 ) ;
You can’t perform that action at this time.
0 commit comments