From 060f7a285f3741b4e419c2eec385ee40b276c674 Mon Sep 17 00:00:00 2001 From: Alan Perdomo Date: Thu, 29 Dec 2022 14:47:19 -0300 Subject: [PATCH] fix(all):Updating imports settings. --- package.json | 4 +- .../admin.gbapp/services/GBAdminService.ts | 48 +++---------------- .../dialogs/StartDialog.ts | 8 +++- .../services/AzureDeployerService.ts | 2 +- 4 files changed, 16 insertions(+), 46 deletions(-) diff --git a/package.json b/package.json index 39539a5f..2a6a2e87 100644 --- a/package.json +++ b/package.json @@ -166,7 +166,6 @@ "yarn": "1.22.19" }, "devDependencies": { - "simple-commit-message": "4.0.13", "@types/url-join": "4.0.1", "ban-sensitive-files": "1.9.18", "commitizen": "4.2.2", @@ -177,6 +176,9 @@ "ngrok": "4.3.3", "prettier-standard": "15.0.1", "semantic-release": "17.2.4", + "simple-commit-message": "4.0.13", + "super-strong-password-generator": "^2.0.2", + "super-strong-password-generator-es": "^2.0.2", "travis-deploy-once": "5.0.11", "ts-node": "10.9.1", "tslint": "6.1.3" diff --git a/packages/admin.gbapp/services/GBAdminService.ts b/packages/admin.gbapp/services/GBAdminService.ts index 30e57331..847b7a24 100644 --- a/packages/admin.gbapp/services/GBAdminService.ts +++ b/packages/admin.gbapp/services/GBAdminService.ts @@ -49,7 +49,7 @@ import { GBSharePointService } from '../../sharepoint.gblib/services/SharePointS import { GuaribasAdmin } from '../models/AdminModel.js'; import msRestAzure from 'ms-rest-azure'; import Path from 'path'; -import PasswordGenerator from 'strict-password-generator'; +import {caseSensitive_Numbs_SpecialCharacters_PW} from 'super-strong-password-generator' import crypto from 'crypto'; /** @@ -92,61 +92,25 @@ export class GBAdminService implements IGBAdminService { } public static getMobileCode () { - const passwordGenerator = new PasswordGenerator(); - const options = { - upperCaseAlpha: false, - lowerCaseAlpha: false, - number: true, - specialCharacter: false, - minimumLength: 6, - maximumLength: 6 - }; - - return passwordGenerator.generatePassword(options); + + return caseSensitive_Numbs_SpecialCharacters_PW(15); } public static getRndPassword (): string { - const passwordGenerator = new PasswordGenerator(); - const options = { - upperCaseAlpha: true, - lowerCaseAlpha: true, - number: true, - specialCharacter: true, - minimumLength: 14, - maximumLength: 14 - }; - let password = passwordGenerator.generatePassword(options); + let password = caseSensitive_Numbs_SpecialCharacters_PW(15); password = password.replace(/[\@\[\=\:\;\?\"\'\#]/gi, '*'); return password; } public static getRndReadableIdentifier () { - const passwordGenerator = new PasswordGenerator(); - const options = { - upperCaseAlpha: false, - lowerCaseAlpha: true, - number: false, - specialCharacter: false, - minimumLength: 14, - maximumLength: 14 - }; - return passwordGenerator.generatePassword(options); + return caseSensitive_Numbs_SpecialCharacters_PW(15); } public static getNumberIdentifier () { - const passwordGenerator = new PasswordGenerator(); - const options = { - upperCaseAlpha: false, - lowerCaseAlpha: false, - number: true, - specialCharacter: false, - minimumLength: 14, - maximumLength: 14 - }; - return passwordGenerator.generatePassword(options); + return caseSensitive_Numbs_SpecialCharacters_PW(15); } /** diff --git a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts index c631506c..0325d74b 100644 --- a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts @@ -73,10 +73,10 @@ export class StartDialog { // Connects to the cloud and retrieves subscriptions. const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password); - const list = await installationDeployer.getSubscriptions(credentials); - + let subscriptionId: string; while (subscriptionId === undefined) { + const list = await installationDeployer.getSubscriptions(credentials); subscriptionId = this.retrieveSubscriptionId(list); } @@ -178,6 +178,10 @@ generate manually an App ID and App Secret.\n` private static retrieveSubscriptionId (list) { let subscriptionId = GBConfigService.get('CLOUD_SUBSCRIPTIONID'); + if (subscriptionId){ + + return subscriptionId; + } const map = {}; let index = 1; list.forEach(element => { diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 2bc9d83f..2db1585c 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -52,7 +52,7 @@ import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigS import { GBDeployer } from '../../../packages/core.gbapp/services/GBDeployer.js'; import { Account } from '@azure/arm-cognitiveservices'; import MicrosoftGraph from '@microsoft/microsoft-graph-client'; -import Spinner from 'cli-spinner'; +import {Spinner} from 'cli-spinner'; import * as publicIp from 'public-ip'; import { AccessToken, TokenCredential } from '@azure/core-auth';