lamassu-server/bin/new-lamassu-register
Rafael Taranto b8e0c2175b feat: add graphql support (#349)
* fix: eslint warnings

* refactor: use ramda + sanctuary instead of lodash

* refactor: use prettier-standard for formatting

* feat: enable security

* feat: add graphql

* chore: remove trailing commas from linter

* docs: new scripts on react and new-admin-server

* feat: handle authentication on graphql

* fix: perf improvement to date picker

* chore: add insecure-dev script to run servers
2019-12-24 15:36:41 +01:00

30 lines
635 B
JavaScript
Executable file

#!/usr/bin/env node
const login = require('../lib/admin/login')
const options = require('../lib/options')
const name = process.argv[2]
const domain = options.hostname
if (!domain) {
console.error('No hostname configured in lamassu.json')
process.exit(1)
}
if (!name) {
console.log('Usage: lamassu-register <username>')
process.exit(2)
}
login.generateOTP(name).then(otp => {
if (domain === 'localhost') {
console.log(`https://${domain}:3000/register?otp=${otp}`)
} else {
console.log(`https://${domain}?otp=${otp}`)
}
process.exit(0)
}).catch(err => {
console.log('Error: %s', err)
process.exit(3)
})