Пример #1
0
users.confirm = function (username, callback) {
  if (!callback) {
    callback = username;
    return callback(new Error('username is required'), true);
  }
  
  jitsu.prompt.get(['Invite code'], function (err, result) {
    var user = {
      username: username,
      inviteCode: result['invite code']
    };
    
    winston.info('Confirming user ' + username.magenta);
    jitsu.users.confirm(user, function (err, result) {
      if (err) {
        return callback(err);
      }

      if (result.error) {
        winston.error(result.error);
      }
      else {
        winston.info('User ' + username.magenta + ' confirmed');
      }

      callback();
    });
  });  
};
Пример #2
0
 function executeDestroy (err, snapshots, name) {
   jitsu.prompt.get(['snapshot'], function (err, result) {
     var snapshot = snapshots.filter(function (snap) {
       return snap.id === result.snapshot;
     })[0];
     
     if (!snapshot) {
       return callback(new Error('Cannot find snapshot with name: ' + result['snapshot'].magenta), true);
     }
     
     jitsu.snapshots.destroy(name, snapshot.id, callback);
   });
 }
Пример #3
0
users.create = function (username, callback) {
  if (!callback) {
    callback = username;
    return callback(new Error('username is required'), true);
  }
  
  jitsu.prompt.get(['email', 'password'], function (err, result) {
    var user = {
      email: result.email,
      password: result.password,
      username: username
    };

    winston.info('Creating user ' + username.magenta);
    jitsu.users.create(user, function (err) {
      return err ? callback(err) : callback();
    });
  });
};