<commit_before>#!/usr/bin/env node
/* eslint-disable no-console,require-jsdoc */
const inquirer = require('inquirer');
const crypto = require('crypto');
const { hash } = require('../../server/utils/password-manager');
const { Sequelize } = require('sequelize');
const { ConnectionInformation, SpecialAccount, Permission } = require('../../server/app/models');
const mysqlConf = require('./mysql');
const { syncPermissions } = require('../../server/permissions-init');

const isCLI = require.main === module;

/**
 *
 * @param configObj Cannot be null
 * @return {Promise<void>}
 */
async function askQuestions(configObj) {

    const questions = [
        {
            type: 'confirm',
            name: 'createAdmin',
            message: 'Do you want to create an admin account?',
            default: false,
            when: !isCLI,
        },
        {
            type: 'input',
            name: 'adminUsername',
            message: 'Username (email) for admin?',
            valid: input => !!input,
        },
        {
            type: 'password',
            name: 'adminPassword',
            message: 'Password for admin, leave blank to generate one (recommended on prod)?',
        },
        {
            type: 'input',
            name: 'adminCode',
            message: 'Code used to do operations (not the password)?',
            valid: input => !!input,<commit_msg>Add email check<commit_after>#!/usr/bin/env node
/* eslint-disable no-console,require-jsdoc */
const inquirer = require('inquirer');
const crypto = require('crypto');
const Joi = require('joi');
const { hash } = require('../../server/utils/password-manager');
const { Sequelize } = require('sequelize');
const { ConnectionInformation, SpecialAccount, Permission } = require('../../server/app/models');
const mysqlConf = require('./mysql');
const { syncPermissions } = require('../../server/permissions-init');

const isCLI = require.main === module;

/**
 *
 * @param configObj Cannot be null
 * @return {Promise<void>}
 */
async function askQuestions(configObj) {

    const questions = [
        {
            type: 'confirm',
            name: 'createAdmin',
            message: 'Do you want to create an admin account?',
            default: false,
            when: !isCLI,
        },
        {
            type: 'input',
            name: 'adminUsername',
            message: 'Username (email) for admin?',
            valid: input => Joi.validate(input, Joi.string().email(), { presence: 'required' }),
        },
        {
            type: 'password',
            name: 'adminPassword',
            message: 'Password for admin, leave blank to generate one (recommended on prod)?',
        },
        {
            type: 'input',
            name: 'adminCode',
            message: 'Code used to do operations (not the password)?',
            valid: input => !!input,
{'fraction_non_alphanumeric': 0.1506276150627615, 'fraction_numerical': 0.0, 'mean_word_length': 2.234498308906426, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6412884', 'n_tokens_mistral': 769, 'n_tokens_neox': 757, 'n_words': 217}