mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 02:12:49 +00:00 
			
		
		
		
	Display default password even if there isn't a default username (#4900)
This fixes the display of the Deluge script.
This commit is contained in:
		@@ -5,7 +5,7 @@ import { Script } from "@/lib/types";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export default function DefaultPassword({ item }: { item: Script }) {
 | 
					export default function DefaultPassword({ item }: { item: Script }) {
 | 
				
			||||||
  const { username, password } = item.default_credentials;
 | 
					  const { username, password } = item.default_credentials;
 | 
				
			||||||
  const hasDefaultLogin = username && password;
 | 
					  const hasDefaultLogin = username || password;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!hasDefaultLogin) return null;
 | 
					  if (!hasDefaultLogin) return null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -23,14 +23,17 @@ export default function DefaultPassword({ item }: { item: Script }) {
 | 
				
			|||||||
        <p className="mb-2 text-sm">
 | 
					        <p className="mb-2 text-sm">
 | 
				
			||||||
          You can use the following credentials to login to the {item.name} {item.type}.
 | 
					          You can use the following credentials to login to the {item.name} {item.type}.
 | 
				
			||||||
        </p>
 | 
					        </p>
 | 
				
			||||||
        {["username", "password"].map((type) => (
 | 
					        {["username", "password"].map((type) => {
 | 
				
			||||||
          <div key={type} className="text-sm">
 | 
					          const value = item.default_credentials[type as "username" | "password"];
 | 
				
			||||||
            {type.charAt(0).toUpperCase() + type.slice(1)}:{" "}
 | 
					          return value && value.trim() !== "" ? (
 | 
				
			||||||
            <Button variant="secondary" size="null" onClick={() => copyCredential(type as "username" | "password")}>
 | 
					            <div key={type} className="text-sm">
 | 
				
			||||||
              {item.default_credentials[type as "username" | "password"]}
 | 
					              {type.charAt(0).toUpperCase() + type.slice(1)}:{" "}
 | 
				
			||||||
            </Button>
 | 
					              <Button variant="secondary" size="null" onClick={() => copyCredential(type as "username" | "password")}>
 | 
				
			||||||
          </div>
 | 
					                {value}
 | 
				
			||||||
        ))}
 | 
					              </Button>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					          ) : null;
 | 
				
			||||||
 | 
					        })}
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user