How to use the readline-sync.questionEMail function in readline-sync

To help you get started, we’ve selected a few readline-sync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github digistump / OakCLI / oak.js View on Github external
function particleLogin() {
  clear();
  //prompt for user and password
  var userName = readlineSync.questionEMail('Particle Username/Email:');
  var password = readlineSync.question('Particle Password:', {
    hideEchoBack: true // The typed text on screen is hidden by `*` (default). 
  });
  console.log('Logging in to Particle...'.green);
  spark.login({username: userName.trim(), password: password.trim()},loginCallback);
}
github GabrielRivera21 / Firebase-Backend-Node-JS / cmds / createsuperuser.js View on Github external
module.exports = function () {
    var user = {
      emailVerified: false,
      disabled: false
    };

    user.email = readlineSync.questionEMail('Please enter an Email:\n');
    user.displayName = readlineSync.question("Please enter the Display Name:\n");

    var isSamePassword = false;
    while (!isSamePassword) {
        var password = readlineSync.question("Enter Password:\n", { hideEchoBack: true, keepWhitespace: true });
        var confirmPassword = readlineSync.question("Confirm Password:\n", { hideEchoBack: true, keepWhitespace: true });
        if (password !== confirmPassword) {
            console.log("Sorry passwords did not match, try again");
        } else {
            isSamePassword = true;
        }
    }

    user.password = password;

    admin.auth().createUser(user).then(function(userRecord) {
github nethruster / nethloader-backend / src / installer / index.js View on Github external
async function addNewUser () {
  let user
  let complete = false
  while (!complete) {
    user = {
      name: readLine.question("Insert the user's name: "),
      email: readLine.questionEMail("Insert the user's email: "),
      isAdmin: readLine.keyInYN('Should the user be an admin?'),
      password: ''
    }
    user.password = askPassword()

    await sleep(400)
    console.log(JSON.stringify(user, null, 2))
    if (!readLine.keyInYN('Is this data correct?')) { continue }
    await createUser(user)
    complete = true
  }
}
function askPassword () {
github mongaku / mongaku / build / utils / create-user.js View on Github external
module.exports = (args, callback) => {
    const email = rl.questionEMail("Email: ");
    const password = rl.question("Password [auto-gen]: ", {
        defaultInput: genPassword(),
        hideEchoBack: true
    });
    const source = rl.question("Source Admin [Optional, Source ID]: ");

    const User = models("User");
    const user = new User({
        email,
        password,
        sourceAdmin: source ? source.split(/,\s*/) : []
    });

    user.save(err => {
        if (err) {
            return callback(err);
github mongaku / mongaku / src / utils / create-user.js View on Github external
module.exports = (args, callback) => {
    const email = rl.questionEMail("Email: ");
    const password = rl.question("Password [auto-gen]: ", {
        defaultInput: genPassword(),
        hideEchoBack: true,
    });
    //const source = rl.question("Source Admin [Optional, Source ID]: ");
    const canViewPrivateSources = rl.keyInYN(
        "Can view private sources? [Y/N]: ",
    );

    const User = models("User");
    const user = new User({
        email,
        password,
        //sourceAdmin: source ? source.split(/[,\s]+/) : [],
        canViewPrivateSources,
    });
github mongaku / mongaku / src / utils / create-admin.js View on Github external
module.exports = (args, callback) => {
    const email = rl.questionEMail("Email: ");
    const password = rl.question("Password [auto-gen]: ", {
        defaultInput: genPassword(),
        hideEchoBack: true,
    });

    const User = models("User");
    const user = new User({
        email,
        password,
        siteAdmin: true,
        canViewPrivateSources: true,
    });

    user.save(err => {
        if (err) {
            return callback(err);
github mongaku / mongaku / build / utils / create-admin.js View on Github external
module.exports = (args, callback) => {
    const email = rl.questionEMail("Email: ");
    const password = rl.question("Password [auto-gen]: ", {
        defaultInput: genPassword(),
        hideEchoBack: true
    });

    const User = models("User");
    const user = new User({
        email,
        password,
        siteAdmin: true
    });

    user.save(err => {
        if (err) {
            return callback(err);
        }