Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/api/IBMi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,17 @@ export default class IBMi {
this.client = new node_ssh.NodeSSH;
}

let additionalAuthenticationFactor: string | undefined;
if (connectionObject.enableMfa) {
delete connectionObject.enableMfa;

if (connectionObject.password) {
callbacks.progress({
message: `Prompting for additional factor.`
});
const additionalFactor = await options.callbacks.inputBox(`Enter your additional factor or press "Enter" if within your TOTP interval`, `Additional Factor`, true);
if (additionalFactor) {
connectionObject.password = `${connectionObject.password}:${additionalFactor}`;
additionalAuthenticationFactor = await options.callbacks.inputBox(`Enter your additional factor or press "Enter" if within your TOTP interval`, `Additional Factor`, true);
if (additionalAuthenticationFactor) {
connectionObject.password = `${connectionObject.password}:${additionalAuthenticationFactor}`;
}
}
}
Expand Down Expand Up @@ -609,7 +610,7 @@ export default class IBMi {
const hasJavaInstalled = (this.remoteFeatures.jdk21 || this.remoteFeatures.jdk17 || this.remoteFeatures.jdk11 || this.remoteFeatures.jdk80);
if (hasJavaInstalled) {
try {
this.sqlJob = await mapepire.newJob(this);
this.sqlJob = await mapepire.newJob(this, { jdbc: { additionalAuthenticationFactor } as any });
if (this.sqlJob.id) {
this.splfUserData = `C4I${this.sqlJob.id.substring(0, this.sqlJob.id.indexOf('/'))}`;
await this.sqlJob.execute(`CALL QSYS2.QCMDEXC('OVRPRTF FILE(*PRTF) SPOOL(*YES) HOLD(*YES) USRDTA(${this.splfUserData}) SPLFOWN(*CURUSRPRF) OVRSCOPE(*JOB)')`);
Expand Down