1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 02:33:46 +00:00

2fa login fixes for duo on safari

This commit is contained in:
Kyle Spearrin
2018-01-18 16:17:58 -05:00
parent 35385b8c98
commit 43f563d187
9 changed files with 77 additions and 14 deletions

View File

@@ -9,6 +9,7 @@ angular
}, 500);
$scope.i18n = i18nService;
$scope.showNewWindowMessage = platformUtilsService.isSafari();
var customWebVaultUrl = null;
if (environmentService.baseUrl) {
@@ -54,7 +55,7 @@ angular
init();
$scope.loginPromise = null;
$scope.login = function (token) {
$scope.login = function (token, sendSuccessToTab) {
if (!token) {
toastr.error(i18nService.verificationCodeRequired, i18nService.errorsOccurred);
return;
@@ -76,7 +77,18 @@ angular
$scope.loginPromise = authService.logIn(email, masterPassword, $scope.providerType, token, $scope.remember.checked);
$scope.loginPromise.then(function () {
$analytics.eventTrack('Logged In From Two-step');
$state.go('tabs.vault', { animation: 'in-slide-left', syncOnLoad: true });
$state.go('tabs.vault', { animation: 'in-slide-left', syncOnLoad: true }).then(function(){
if (sendSuccessToTab) {
$timeout(function() {
BrowserApi.tabSendMessage(sendSuccessToTab, {
command: '2faPageData',
data: {
type: 'success'
}
});
}, 1000);
}
});
}, function () {
u2f.start();
});
@@ -126,7 +138,7 @@ angular
console.log('got 2fa response');
console.log(details);
if (details.type === 'duo') {
$scope.login(details.data.sigValue);
$scope.login(details.data.sigValue, details.tab);
}
});
@@ -174,7 +186,7 @@ angular
signature: params.Signature
}
});
}, 1000);
}, 500);
}
else {
$window.Duo.init({

View File

@@ -52,9 +52,12 @@
<div class="title">Duo</div>
</div>
<div class="content">
<div id="duoFrameWrapper">
<div id="duoFrameWrapper" ng-if="!showNewWindowMessage">
<iframe id="duo_iframe"></iframe>
</div>
<div ng-if="showNewWindowMessage">
<div class="two-step-window-message">Complete your two-step login request using the new window.</div>
</div>
<div class="list">
<div class="list-section">
<div class="list-section-items">

View File

@@ -26,8 +26,6 @@ export class MainController implements ng.IController {
});
$window.bitwardenPopupMainMessageListener = (msg: any, sender: any, sendResponse: any) => {
console.log(msg);
if (msg.command === 'syncCompleted') {
$scope.$broadcast('syncCompleted', msg.successfully);
} else if (msg.command === 'syncStarted') {
@@ -51,6 +49,7 @@ export class MainController implements ng.IController {
$scope.$broadcast('2faPageResponse', {
type: msg.type,
data: msg.data,
tab: sender.tab,
});
}
};

View File

@@ -587,6 +587,11 @@
}
}
.two-step-window-message {
text-align: center;
margin: 30px 0 20px 0;
}
#duoFrameWrapper {
background: ~"url('../images/loading.svg') 0 0 no-repeat";
width: 100%;