fix(basic.gblib): Now BASIC only runs after auth.
This commit is contained in:
parent
00b49d779d
commit
dfb869e796
1 changed files with 21 additions and 2 deletions
|
@ -187,11 +187,16 @@ export class GBVMService extends GBService {
|
||||||
tolist = this.getToLst;
|
tolist = this.getToLst;
|
||||||
headers = {};
|
headers = {};
|
||||||
|
|
||||||
|
hear gbLogin as login
|
||||||
|
|
||||||
${code}
|
${code}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// Keywords from General Bots BASIC.
|
// Keywords from General Bots BASIC.
|
||||||
|
|
||||||
|
code = code.replace(/hear (\w+) as login/gi, ($0, $1) => {
|
||||||
|
return `${$1} = hear("login")`;
|
||||||
|
});
|
||||||
code = code.replace(/hear (\w+) as email/gi, ($0, $1) => {
|
code = code.replace(/hear (\w+) as email/gi, ($0, $1) => {
|
||||||
return `${$1} = hear("email")`;
|
return `${$1} = hear("email")`;
|
||||||
});
|
});
|
||||||
|
@ -547,7 +552,6 @@ export class GBVMService extends GBService {
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
private addHearDialog(min) {
|
private addHearDialog(min) {
|
||||||
min.dialogs.add(
|
min.dialogs.add(
|
||||||
new WaterfallDialog('/hear', [
|
new WaterfallDialog('/hear', [
|
||||||
|
@ -565,7 +569,22 @@ export class GBVMService extends GBService {
|
||||||
GBLog.info('BASIC: Asking for input (HEAR).');
|
GBLog.info('BASIC: Asking for input (HEAR).');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
step.activeDialog.state.options = step.options;
|
||||||
|
if (step.activeDialog.state.options['kind'] === "login") {
|
||||||
|
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
|
||||||
|
GBLog.info('BASIC: Authenticating beforing running General Bots BASIC code.');
|
||||||
|
return await step.beginDialog('/auth');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return await step.next(step.options);
|
||||||
|
},
|
||||||
|
async step => {
|
||||||
|
if (step.activeDialog.state.options['kind'] === "login") {
|
||||||
|
return await step.next(step.options);
|
||||||
|
} else {
|
||||||
return await min.conversationalService.prompt(min, step, null);
|
return await min.conversationalService.prompt(min, step, null);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
async step => {
|
async step => {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue