refactor: user agent parsing
This commit is contained in:
parent
791b275cdf
commit
839e6aae47
8 changed files with 21 additions and 63 deletions
|
|
@ -68,10 +68,12 @@ app.use('/front-camera-photo', serveStatic(frontCameraBasedir, { index: false })
|
|||
|
||||
app.get('/api/register', (req, res, next) => {
|
||||
const otp = req.query.otp
|
||||
const ua = req.headers['user-agent']
|
||||
const ip = req.ip
|
||||
|
||||
if (!otp) return next()
|
||||
|
||||
return login.register(req)
|
||||
return login.register(otp, ua, ip)
|
||||
.then(r => {
|
||||
if (r.expired) return res.status(401).send('OTP expired, generate new registration link')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue