diff --git a/src/lib/routes/u2f.js b/src/lib/routes/u2f.js index 6cca442e0..0f504fa25 100644 --- a/src/lib/routes/u2f.js +++ b/src/lib/routes/u2f.js @@ -162,7 +162,8 @@ function sign(req, res) { req.session.auth_session.second_factor = true; res.status(204); res.send(); - }, function(err) { + }) + .catch(function(err) { logger.error('U2F sign: %s', err); res.status(401); res.send(); diff --git a/test/unitary/routes/test_u2f.js b/test/unitary/routes/test_u2f.js index 1c26c1cb0..4d28ee04f 100644 --- a/test/unitary/routes/test_u2f.js +++ b/test/unitary/routes/test_u2f.js @@ -220,7 +220,7 @@ describe('test u2f routes', function() { req.session.auth_session.sign_request = {}; req.app.get.withArgs('u2f').returns(u2f_mock); - u2f.register(req, res); + u2f.sign(req, res); }); it('should return unauthorized error when no sign request has been initiated', function(done) { @@ -234,7 +234,7 @@ describe('test u2f routes', function() { u2f_mock.finishAuthentication.returns(Promise.resolve()); req.app.get.withArgs('u2f').returns(u2f_mock); - u2f.register(req, res); + u2f.sign(req, res); }); } });