From 3e61d938bc01c06396b16556664f79577ccb570d Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 27 Jun 2017 08:14:03 -0400 Subject: [PATCH] token sanitization and adjust timeouts on u2f --- src/app/accounts/accountsLoginController.js | 7 ++++++- src/app/services/authService.js | 2 +- src/app/settings/settingsTwoStepU2fController.js | 2 +- src/js/u2f-connector.js | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/accounts/accountsLoginController.js b/src/app/accounts/accountsLoginController.js index bdf12635de..34fe54ae71 100644 --- a/src/app/accounts/accountsLoginController.js +++ b/src/app/accounts/accountsLoginController.js @@ -98,6 +98,11 @@ angular } $scope.twoFactor = function (token) { + if ($scope.twoFactorProvider === constants.twoFactorProvider.email + || $scope.twoFactorProvider === constants.twoFactorProvider.authenticator) { + token = token.replace(' ', ''); + } + $scope.twoFactorPromise = authService.logIn(_email, _masterPassword, token, $scope.twoFactorProvider, $scope.rememberTwoFactor.checked || false); @@ -211,6 +216,6 @@ angular return; } $scope.twoFactor(JSON.stringify(data)); - }, 5); + }, 10); } }); diff --git a/src/app/services/authService.js b/src/app/services/authService.js index f4062b481e..95bcf68a33 100644 --- a/src/app/services/authService.js +++ b/src/app/services/authService.js @@ -20,7 +20,7 @@ angular if (token && typeof (provider) !== 'undefined' && provider !== null) { remember = remember || remember !== false; - request.twoFactorToken = token.replace(' ', ''); + request.twoFactorToken = token; request.twoFactorProvider = provider; request.twoFactorRemember = remember ? '1' : '0'; } diff --git a/src/app/settings/settingsTwoStepU2fController.js b/src/app/settings/settingsTwoStepU2fController.js index 89467ea25d..82cb88be01 100644 --- a/src/app/settings/settingsTwoStepU2fController.js +++ b/src/app/settings/settingsTwoStepU2fController.js @@ -53,7 +53,7 @@ $scope.deviceResponse = JSON.stringify(data); $scope.$apply(); - }, 5); + }, 10); }; $scope.submit = function () { diff --git a/src/js/u2f-connector.js b/src/js/u2f-connector.js index 4ee824f7ab..4e5c2e54c8 100644 --- a/src/js/u2f-connector.js +++ b/src/js/u2f-connector.js @@ -81,7 +81,7 @@ function initU2f(obj) { } success(data); - }, 5); + }, 10); } function onMessage() {