Skip to content

Commit fb1364b

Browse files
committed
Throw error when login credentials are incorrect
Signed-off-by: Jessica He <jhe@redhat.com>
1 parent 48ed462 commit fb1364b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/openshift/cluster.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export class Cluster extends OpenShiftItem {
430430
try {
431431
const result = await Progress.execFunctionWithProgress(
432432
`Login to the cluster: ${clusterURL}`,
433-
() => Cluster.cli.executeTool(Command.odoLoginWithUsernamePassword(clusterURL, username, passwd)));
433+
() => Cluster.cli.executeTool(Command.odoLoginWithUsernamePassword(clusterURL, username, passwd), undefined, true));
434434
await Cluster.save(username, passwd, password, result);
435435
return await Cluster.loginMessage(clusterURL, result);
436436
} catch (error) {

src/util/filters.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ export class Filters {
1212

1313
static readonly passwordRegex = /-p\s+'([^']+)'/;
1414

15+
static readonly passwordAssignRegex = /-p='([^']+)'/;
16+
1517
static filterPassword(value: string): string {
16-
return value ? value.replace(Filters.passwordRegex, '-p **********') : value;
18+
if (!value) return value;
19+
return value.match(Filters.passwordRegex) != null ? value.replace(Filters.passwordRegex, '-p **********') : value.replace(Filters.passwordAssignRegex, '-p=\'**********\'');
1720
}
1821
}

0 commit comments

Comments
 (0)