Skip to content

Commit

Permalink
Hang up on enter empty password #3684
Browse files Browse the repository at this point in the history
Fixes: #3684

Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
  • Loading branch information
vrubezhny committed Dec 7, 2023
1 parent ff12285 commit 5b58008
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/openshift/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export class Cluster extends OpenShiftItem {
// which means this request will always fail on crc unless cert checking is disabled
strictSSL: false
});

// since the fetch didn't throw an exception,
// a route to the cluster is available,
// so it's running
Expand Down Expand Up @@ -579,7 +580,7 @@ export class Cluster extends OpenShiftItem {
case Step.enterUserName:
if (!username) {
const prompt = 'Provide Username for basic authentication to the API server';
const validateInput = (value: string) => NameValidator.emptyName('User name cannot be empty', value);
const validateInput = (value: string) => NameValidator.emptyName('User name cannot be empty', value ? value : '');
const newUsername = await inputValue(prompt, '', false, validateInput);

if (newUsername === null) {
Expand All @@ -597,7 +598,7 @@ export class Cluster extends OpenShiftItem {
if (!passwd) {
password = await TokenStore.getItem('login', username);
const prompt = 'Provide Password for basic authentication to the API server';
const validateInput = (value: string) => NameValidator.emptyName('Password cannot be empty', value);
const validateInput = (value: string) => NameValidator.emptyName('Password cannot be empty', value ? value : '');
const newPassword = await inputValue(prompt, password, true, validateInput);

if (newPassword === null) {
Expand Down Expand Up @@ -694,9 +695,8 @@ export class Cluster extends OpenShiftItem {
let ocToken: string;
if (!userToken) {
const prompt = 'Provide Bearer token for authentication to the API server';
const validateInput = (value: string) => NameValidator.emptyName('Bearer token cannot be empty', value);
const initialValue = token ? token : '';
ocToken = await inputValue(prompt, initialValue, true, validateInput);
const validateInput = (value: string) => NameValidator.emptyName('Bearer token cannot be empty', value ? value : '');
ocToken = await inputValue(prompt, token ? token : '', true, validateInput);
if (ocToken === null) {
return null; // Cancel
} else if (!ocToken) {
Expand Down

0 comments on commit 5b58008

Please sign in to comment.