This commit is contained in:
Josh Harvey 2016-05-06 04:28:15 +03:00
parent cd1e9bdb66
commit 3e48e50757
5 changed files with 110 additions and 11 deletions

View file

@ -224,6 +224,24 @@ function phoneCode (req, res) {
})
}
function updatePhone (req, res) {
return plugins.updatePhone(session(req), req.body.phone)
.then(code => res.send(200))
.catch(err => {
logger.error(err)
res.send(500)
})
}
function fetchPhoneTx (req, res) {
return plugins.updatePhone(req.query.phone)
.then(code => res.send(200))
.catch(err => {
logger.error(err)
res.send(500)
})
}
function init (localConfig) {
lamassuConfig = localConfig.lamassuConfig
plugins = localConfig.plugins
@ -248,6 +266,8 @@ function init (localConfig) {
app.post('/pair', pair)
app.post('/phone_code', authMiddleware, phoneCode)
app.post('/update-phone', authMiddleware, updatePhone)
app.get('/phone-tx', authMiddleware, fetchPhoneTx)
localApp.get('/pid', function (req, res) {
var machineFingerprint = req.query.fingerprint