Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
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) {
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 () {
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);
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,
});
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);
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);
}