OurBigBook Docs OurBigBook.comSite
Change password for a given user. Usage:
set-password <username> <new-password>
Note that this can also be achieved on the web interface by visiting the settings page of a target user with an OurBigBook Admin account.
web/bin/set-password
#!/usr/bin/env node

// https://docs.ourbigbook.com/web/bin/set-password

const path = require('path')

const commander = require('commander')

const models = require('../models')

// CLI arguments
const program = commander.program
program.allowExcessArguments(false)
program.argument('<username>', 'username')
program.argument('<password>', 'password')
program.parse(process.argv);
const opts = program.opts()
const [username, password] = program.processedArgs

// main
const sequelize = models.getSequelize(path.dirname(__dirname));
(async () => {
const user = await sequelize.models.User.findOne({ where: { username }})
await sequelize.models.User.setPassword(user, password)
await user.save()
})().finally(() => { return sequelize.close() });

Ancestors (6)

  1. Web CLI utils
  2. OurBigBook Web directory structure
  3. OurBigBook Web architecture
  4. OurBigBook Web development
  5. OurBigBook Web
  6. OurBigBook Project