refactor otp assignment slightly
This commit is contained in:
parent
58f06a7bf3
commit
32b87f2486
|
@ -534,6 +534,21 @@ function parseConfig(err, text) {
|
|||
throw err;
|
||||
}
|
||||
|
||||
// TODO make one request to set and then poll for readiness
|
||||
if (!answers.token && answers._can_pair) {
|
||||
console.log("");
|
||||
console.log("==============================================");
|
||||
console.log(" Hey, Listen! ");
|
||||
console.log("==============================================");
|
||||
console.log(" ");
|
||||
console.log(" GO CHECK YOUR EMAIL! ");
|
||||
console.log(" ");
|
||||
console.log(" DEVICE PAIR CODE: 0000 ".replace(/0000/g, answers._otp));
|
||||
console.log(" ");
|
||||
console.log("==============================================");
|
||||
console.log("");
|
||||
}
|
||||
|
||||
// TODO use php-style object querification
|
||||
utils.putConfig('config', Object.keys(answers).map(function (key) {
|
||||
return key + ':' + answers[key];
|
||||
|
@ -618,17 +633,6 @@ var parsers = {
|
|||
|
||||
if (!answers.token && answers._can_pair) {
|
||||
answers._otp = common.otp();
|
||||
console.log("");
|
||||
console.log("==============================================");
|
||||
console.log(" Hey, Listen! ");
|
||||
console.log("==============================================");
|
||||
console.log(" ");
|
||||
console.log(" GO CHECK YOUR EMAIL! ");
|
||||
console.log(" ");
|
||||
console.log(" DEVICE PAIR CODE: 0000 ".replace(/0000/g, answers._otp));
|
||||
console.log(" ");
|
||||
console.log("==============================================");
|
||||
console.log("");
|
||||
}
|
||||
|
||||
cb(null, answers);
|
||||
|
|
|
@ -166,7 +166,7 @@ function serveControlsHelper() {
|
|||
if ('undefined' !== typeof conf.agree_tos) {
|
||||
state.config.agreeTos = conf.agree_tos;
|
||||
}
|
||||
state.otp = conf._otp || common.otp();
|
||||
state.otp = conf._otp || '0000'; // this should only be done on the client side
|
||||
state.config.relay = conf.relay || state.config.relay || '';
|
||||
state.config.token = conf.token || state.config.token || null;
|
||||
state.config.secret = conf.secret || state.config.secret || null;
|
||||
|
|
|
@ -105,7 +105,7 @@ common.api.token = function (state, handlers) {
|
|||
|
||||
// TODO sign token with own private key, including public key and thumbprint
|
||||
// (much like ACME JOSE account)
|
||||
var otp = state.otp || state._otp || common.otp();
|
||||
var otp = state.otp || state._otp || '0000'; // common.otp();
|
||||
var authReq = state.authRequest || state._auth || {
|
||||
subject: state.config.email
|
||||
, subject_scheme: 'mailto'
|
||||
|
|
Loading…
Reference in New Issue