mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
25 lines
915 B
JavaScript
25 lines
915 B
JavaScript
angular
|
|
.module('bit.accounts')
|
|
|
|
.controller('accountsLoginTwoFactorController', function ($scope, $state, loginService, toastr, utilsService,
|
|
$analytics, i18nService) {
|
|
$scope.i18n = i18nService;
|
|
$scope.model = {};
|
|
utilsService.initListSectionItemListeners($(document), angular);
|
|
$('#code').focus();
|
|
|
|
$scope.loginPromise = null;
|
|
$scope.login = function (model) {
|
|
if (!model.code) {
|
|
toastr.error(i18nService.verificationCodeRequired, i18nService.errorsOccurred);
|
|
return;
|
|
}
|
|
|
|
$scope.loginPromise = loginService.logInTwoFactor(model.code);
|
|
$scope.loginPromise.then(function () {
|
|
$analytics.eventTrack('Logged In From Two-step');
|
|
$state.go('tabs.vault', { animation: 'in-slide-left', syncOnLoad: true });
|
|
});
|
|
};
|
|
});
|