UI: Check if any of the credentials are not null

This commit is contained in:
Ilija Lazoroski 2022-07-21 10:53:08 +02:00
parent 47f78d1a2d
commit 9fdbcc441d
1 changed files with 12 additions and 3 deletions

View File

@ -8,7 +8,10 @@ export function getAllUsernames(stolen, configured){
export function getCredentialsUsernames(credentials) { export function getCredentialsUsernames(credentials) {
let usernames = []; let usernames = [];
for(let i = 0; i < credentials.length; i++){ for(let i = 0; i < credentials.length; i++){
usernames.push(credentials[i]['identity']['username']); let username = credentials[i]['identity'];
if(username !== null) {
usernames.push(username['username']);
}
} }
return usernames; return usernames;
} }
@ -16,10 +19,16 @@ export function getCredentialsUsernames(credentials) {
export function getAllSecrets(stolen, configured){ export function getAllSecrets(stolen, configured){
let secrets = []; let secrets = [];
for(let i = 0; i < stolen.length; i++){ for(let i = 0; i < stolen.length; i++){
secrets.push(getSecretsFromCredential(stolen[i]['secret'])); let secret = stolen[i]['secret'];
if(secret !== null){
secrets.push(getSecretsFromCredential(secret));
}
} }
for(let i = 0; i < configured.length; i++){ for(let i = 0; i < configured.length; i++){
secrets.push(getSecretsFromCredential(configured[i]['secret'])); let secret = configured[i]['secret'];
if(secret !== null){
secrets.push(getSecretsFromCredential(secret));
}
} }
return secrets; return secrets;
} }