mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
u2f fixes. bg vars with prefix
This commit is contained in:
@@ -6,6 +6,19 @@
|
||||
$scope.i18n = i18nService;
|
||||
utilsService.initListSectionItemListeners($(document), angular);
|
||||
|
||||
var u2f = new U2f(function (data) {
|
||||
$scope.login(data);
|
||||
$scope.$apply();
|
||||
}, function (error) {
|
||||
toastr.error(error, i18nService.errorsOccurred);
|
||||
$scope.$apply();
|
||||
}, function (info) {
|
||||
if (info === 'ready') {
|
||||
$scope.u2fReady = true;
|
||||
}
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
var constants = constantsService;
|
||||
var email = $stateParams.email;
|
||||
var masterPassword = $stateParams.masterPassword;
|
||||
@@ -31,7 +44,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if ($scope.providerType === constants.twoFactorProvider.email ||
|
||||
if ($scope.providerType === constants.twoFactorProvider.u2f) {
|
||||
if (u2f) {
|
||||
u2f.stop();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ($scope.providerType === constants.twoFactorProvider.email ||
|
||||
$scope.providerType === constants.twoFactorProvider.authenticator) {
|
||||
token = token.replace(' ', '')
|
||||
}
|
||||
@@ -40,6 +61,9 @@
|
||||
$scope.loginPromise.then(function () {
|
||||
$analytics.eventTrack('Logged In From Two-step');
|
||||
$state.go('tabs.vault', { animation: 'in-slide-left', syncOnLoad: true });
|
||||
u2f = null;
|
||||
}, function () {
|
||||
u2f.start();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -67,7 +91,8 @@
|
||||
};
|
||||
|
||||
$scope.anotherMethod = function () {
|
||||
$analytics.eventTrack('Selected Another Two Factor Method');
|
||||
u2f.stop();
|
||||
u2f = null;
|
||||
$state.go('twoFactorMethods', {
|
||||
animation: 'in-slide-up',
|
||||
email: email,
|
||||
@@ -77,6 +102,14 @@
|
||||
});
|
||||
};
|
||||
|
||||
$scope.back = function () {
|
||||
u2f.stop();
|
||||
u2f = null;
|
||||
$state.go('login', {
|
||||
animation: 'out-slide-right'
|
||||
});
|
||||
};
|
||||
|
||||
function getDefaultProvider(twoFactorProviders) {
|
||||
var keys = Object.keys(twoFactorProviders);
|
||||
var providerType = null;
|
||||
@@ -97,6 +130,8 @@
|
||||
}
|
||||
|
||||
function init() {
|
||||
u2f.stop();
|
||||
|
||||
$timeout(function () {
|
||||
$('#code').focus();
|
||||
|
||||
@@ -116,19 +151,6 @@
|
||||
var params = providers[constants.twoFactorProvider.u2f];
|
||||
var challenges = JSON.parse(params.Challenges);
|
||||
|
||||
var u2f = new U2f(function (data) {
|
||||
$scope.login(data);
|
||||
$scope.$apply();
|
||||
}, function (error) {
|
||||
toastr.error(error, i18nService.errorsOccurred);
|
||||
$scope.$apply();
|
||||
}, function (info) {
|
||||
if (info === 'ready') {
|
||||
$scope.u2fReady = true;
|
||||
}
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
u2f.init({
|
||||
appId: challenges[0].appId,
|
||||
challenge: challenges[0].challenge,
|
||||
|
||||
Reference in New Issue
Block a user