Skip to content

Commit

Permalink
Save password during connection via API
Browse files Browse the repository at this point in the history
  • Loading branch information
worksofliam committed Nov 6, 2023
1 parent f173aec commit 51c84ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ export async function activate(context: ExtensionContext): Promise<CodeForIBMi>
new ProfilesView(context)
),
commands.registerCommand(`code-for-ibmi.connectDirect`,
async (connectionData: ConnectionData, reloadSettings = false): Promise<boolean> => {
async (connectionData: ConnectionData, reloadSettings = false, savePassword = false): Promise<boolean> => {
const existingConnection = instance.getConnection();

if (existingConnection) {
return false;
}

if (savePassword && connectionData.password) {
context.secrets.store(`${connectionData.name}_password`, `${connectionData.password}`);
}

return (await new IBMi().connect(connectionData, undefined, reloadSettings)).success;
}
),
Expand Down

0 comments on commit 51c84ca

Please sign in to comment.