From 178d1fb8610da04fc2fd932b39256217ebe0ae43 Mon Sep 17 00:00:00 2001 From: jellypuno Date: Mon, 9 Dec 2019 10:46:17 +0100 Subject: [PATCH 1/3] Add validation for undefined username and password + more cosmetic fix Signed-off-by: jellypuno --- i18n/sample/src/Profiles.i18n.json | 6 ++++-- i18n/sample/src/extension.i18n.json | 2 +- src/Profiles.ts | 16 ++++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/i18n/sample/src/Profiles.i18n.json b/i18n/sample/src/Profiles.i18n.json index 30dd3592fa..9790789495 100644 --- a/i18n/sample/src/Profiles.i18n.json +++ b/i18n/sample/src/Profiles.i18n.json @@ -5,9 +5,11 @@ "createNewConnection.option.prompt.url": "Enter a z/OSMF URL in the format 'https://url:port'.", "createNewConnection.enterzosmfURL": "No valid value for z/OSMF URL. Operation Cancelled", "createNewConnection.option.prompt.userName.placeholder": "Optional: User Name", - "createNewConnection.option.prompt.userName": "Enter the user name for the connection", + "createNewConnection.option.prompt.userName": "Enter the user name for the connection. Leave blank to not store.", + "createNewConnection.undefined.enteruserName": "Operation Cancelled", "createNewConnection.option.prompt.passWord.placeholder": "Optional: Password", - "createNewConnection.option.prompt.password": "Enter a password for the connection", + "createNewConnection.option.prompt.password": "Enter the password for the connection. Leave blank to not store.", + "createNewConnection.undefined.enterpassWord": "Operation Cancelled", "createNewConnection.option.prompt.ru.placeholder": "Reject Unauthorized Connections", "createNewConnection.rejectUnauthorize": "Operation Cancelled", "createNewConnection.duplicateProfileName": "Profile name already exists. Please create a profile using a different name", diff --git a/i18n/sample/src/extension.i18n.json b/i18n/sample/src/extension.i18n.json index 66bf989920..10080f717b 100644 --- a/i18n/sample/src/extension.i18n.json +++ b/i18n/sample/src/extension.i18n.json @@ -90,9 +90,9 @@ "saveFile.log.error.session": "Couldn't locate session when saving data set!", "saveFile.log.debug.saving": "Saving file ", "saveFile.error.saveFailed": "Data set failed to save. Data set may have been deleted on mainframe.", + "saveFile.response.save.title": "Saving data set...", "saveFile.error.ZosmfEtagMismatchError": "Rest API failure with HTTP(S) status 412", "saveFile.error.etagMismatch": "Remote file has been modified in the meantime.\nSelect 'Compare' to resolve the conflict.", - "saveFile.response.save.title": "Saving data set...", "saveUSSFile.log.debug.saveRequest": "save requested for USS file ", "saveUSSFile.response.title": "Saving file...", "saveUSSFile.log.error.save": "Error encountered when saving USS file: ", diff --git a/src/Profiles.ts b/src/Profiles.ts index c63ed3a2aa..7a0b592032 100644 --- a/src/Profiles.ts +++ b/src/Profiles.ts @@ -164,19 +164,31 @@ export class Profiles { // Processing stops if there are no profiles detected options = { placeHolder: localize("createNewConnection.option.prompt.userName.placeholder", "Optional: User Name"), - prompt: localize("createNewConnection.option.prompt.userName", "Enter the user name for the connection"), + prompt: localize("createNewConnection.option.prompt.userName", "Enter the user name for the connection. Leave blank to not store."), value: userName }; userName = await vscode.window.showInputBox(options); + if (userName === undefined) { + vscode.window.showInformationMessage(localize("createNewConnection.undefined.enteruserName", + "Operation Cancelled")); + return; + } + options = { placeHolder: localize("createNewConnection.option.prompt.password.placeholder", "Optional: Password"), - prompt: localize("createNewConnection.option.prompt.password", "Enter a password for the connection"), + prompt: localize("createNewConnection.option.prompt.password", "Enter the password for the connection. Leave blank to not store."), password: true, value: passWord }; passWord = await vscode.window.showInputBox(options); + if (passWord === undefined) { + vscode.window.showInformationMessage(localize("createNewConnection.undefined.enterpassWord", + "Operation Cancelled")); + return; + } + const quickPickOptions: vscode.QuickPickOptions = { placeHolder: localize("createNewConnection.option.prompt.ru.placeholder", "Reject Unauthorized Connections"), ignoreFocusOut: true, From 555cfd3e30df07923fb1f5b8f7a9162c2d010d2b Mon Sep 17 00:00:00 2001 From: jellypuno Date: Wed, 11 Dec 2019 15:11:42 +0100 Subject: [PATCH 2/3] Fix i18n files Signed-off-by: jellypuno --- i18n/sample/src/Profiles.i18n.json | 8 ++++---- src/Profiles.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/i18n/sample/src/Profiles.i18n.json b/i18n/sample/src/Profiles.i18n.json index 9fec672fc0..8a269f27fb 100644 --- a/i18n/sample/src/Profiles.i18n.json +++ b/i18n/sample/src/Profiles.i18n.json @@ -4,13 +4,13 @@ "loadNamedProfile.warn.noDefaultProfile": "Unable to locate a default profile. CLI may not be installed. ", "createNewConnection.option.prompt.url.placeholder": "https://url:port", "createNewConnection.option.prompt.url": "Enter a z/OSMF URL in the format 'https://url:port'.", - "createNewConnection.enterzosmfURL": "No valid value for z/OSMF URL. Operation Cancelled", + "createNewConnection.zosmfURL": "No valid value for z/OSMF URL. Operation Cancelled", "createNewConnection.option.prompt.userName.placeholder": "Optional: User Name", "createNewConnection.option.prompt.userName": "Enter the user name for the connection. Leave blank to not store.", - "createNewConnection.undefined.enteruserName": "Operation Cancelled", - "createNewConnection.option.prompt.passWord.placeholder": "Optional: Password", + "createNewConnection.undefined.userName": "Operation Cancelled", + "createNewConnection.option.prompt.password.placeholder": "Optional: Password", "createNewConnection.option.prompt.password": "Enter the password for the connection. Leave blank to not store.", - "createNewConnection.undefined.enterpassWord": "Operation Cancelled", + "createNewConnection.undefined.passWord": "Operation Cancelled", "createNewConnection.option.prompt.ru.placeholder": "Reject Unauthorized Connections", "createNewConnection.rejectUnauthorize": "Operation Cancelled", "createNewConnection.duplicateProfileName": "Profile name already exists. Please create a profile using a different name", diff --git a/src/Profiles.ts b/src/Profiles.ts index 7a0b592032..f085af49be 100644 --- a/src/Profiles.ts +++ b/src/Profiles.ts @@ -155,7 +155,7 @@ export class Profiles { // Processing stops if there are no profiles detected }); if (!zosmfURL) { - vscode.window.showInformationMessage(localize("createNewConnection.enterzosmfURL", + vscode.window.showInformationMessage(localize("createNewConnection.zosmfURL", "No valid value for z/OSMF URL. Operation Cancelled")); return; } @@ -170,7 +170,7 @@ export class Profiles { // Processing stops if there are no profiles detected userName = await vscode.window.showInputBox(options); if (userName === undefined) { - vscode.window.showInformationMessage(localize("createNewConnection.undefined.enteruserName", + vscode.window.showInformationMessage(localize("createNewConnection.undefined.userName", "Operation Cancelled")); return; } @@ -184,7 +184,7 @@ export class Profiles { // Processing stops if there are no profiles detected passWord = await vscode.window.showInputBox(options); if (passWord === undefined) { - vscode.window.showInformationMessage(localize("createNewConnection.undefined.enterpassWord", + vscode.window.showInformationMessage(localize("createNewConnection.undefined.passWord", "Operation Cancelled")); return; } From f18650e33abaccf9d426d7341408237f9a43b3d5 Mon Sep 17 00:00:00 2001 From: jellypuno Date: Wed, 11 Dec 2019 15:23:35 +0100 Subject: [PATCH 3/3] change i18n files for consistency Signed-off-by: jellypuno --- i18n/sample/src/Profiles.i18n.json | 14 +++++++------- src/Profiles.ts | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/i18n/sample/src/Profiles.i18n.json b/i18n/sample/src/Profiles.i18n.json index 8a269f27fb..6923ea8ecc 100644 --- a/i18n/sample/src/Profiles.i18n.json +++ b/i18n/sample/src/Profiles.i18n.json @@ -5,19 +5,19 @@ "createNewConnection.option.prompt.url.placeholder": "https://url:port", "createNewConnection.option.prompt.url": "Enter a z/OSMF URL in the format 'https://url:port'.", "createNewConnection.zosmfURL": "No valid value for z/OSMF URL. Operation Cancelled", - "createNewConnection.option.prompt.userName.placeholder": "Optional: User Name", - "createNewConnection.option.prompt.userName": "Enter the user name for the connection. Leave blank to not store.", - "createNewConnection.undefined.userName": "Operation Cancelled", + "createNewConnection.option.prompt.username.placeholder": "Optional: User Name", + "createNewConnection.option.prompt.username": "Enter the user name for the connection. Leave blank to not store.", + "createNewConnection.undefined.username": "Operation Cancelled", "createNewConnection.option.prompt.password.placeholder": "Optional: Password", "createNewConnection.option.prompt.password": "Enter the password for the connection. Leave blank to not store.", - "createNewConnection.undefined.passWord": "Operation Cancelled", + "createNewConnection.undefined.password": "Operation Cancelled", "createNewConnection.option.prompt.ru.placeholder": "Reject Unauthorized Connections", "createNewConnection.rejectUnauthorize": "Operation Cancelled", "createNewConnection.duplicateProfileName": "Profile name already exists. Please create a profile using a different name", - "promptcredentials.option.prompt.userName.placeholder": "User Name", - "promptcredentials.option.prompt.userName": "Enter the user name for the connection", + "promptcredentials.option.prompt.username.placeholder": "User Name", + "promptcredentials.option.prompt.username": "Enter the user name for the connection", "promptcredentials.invalidusername": "Please enter your z/OS username. Operation Cancelled", - "promptcredentials.option.prompt.passWord.placeholder": "Password", + "promptcredentials.option.prompt.password.placeholder": "Password", "promptcredentials.option.prompt.password": "Enter a password for the connection", "promptcredentials.invalidpassword": "Please enter your z/OS password. Operation Cancelled" } \ No newline at end of file diff --git a/src/Profiles.ts b/src/Profiles.ts index f085af49be..3379f35fb8 100644 --- a/src/Profiles.ts +++ b/src/Profiles.ts @@ -163,14 +163,14 @@ export class Profiles { // Processing stops if there are no profiles detected const zosmfUrlParsed = this.validateAndParseUrl(zosmfURL); options = { - placeHolder: localize("createNewConnection.option.prompt.userName.placeholder", "Optional: User Name"), - prompt: localize("createNewConnection.option.prompt.userName", "Enter the user name for the connection. Leave blank to not store."), + placeHolder: localize("createNewConnection.option.prompt.username.placeholder", "Optional: User Name"), + prompt: localize("createNewConnection.option.prompt.username", "Enter the user name for the connection. Leave blank to not store."), value: userName }; userName = await vscode.window.showInputBox(options); if (userName === undefined) { - vscode.window.showInformationMessage(localize("createNewConnection.undefined.userName", + vscode.window.showInformationMessage(localize("createNewConnection.undefined.username", "Operation Cancelled")); return; } @@ -252,8 +252,8 @@ export class Profiles { // Processing stops if there are no profiles detected if (!loadSession.user) { options = { - placeHolder: localize("promptcredentials.option.prompt.userName.placeholder", "User Name"), - prompt: localize("promptcredentials.option.prompt.userName", "Enter the user name for the connection"), + placeHolder: localize("promptcredentials.option.prompt.username.placeholder", "User Name"), + prompt: localize("promptcredentials.option.prompt.username", "Enter the user name for the connection"), value: userName }; userName = await vscode.window.showInputBox(options);