mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 02:33:46 +00:00
2fa page for duo in safari
This commit is contained in:
@@ -122,6 +122,12 @@ angular
|
||||
u2f = null;
|
||||
});
|
||||
|
||||
$scope.$on('2faPageResponse', (event, details) => {
|
||||
if (details.type === 'duo') {
|
||||
$scope.login(details.data.sigValue);
|
||||
}
|
||||
});
|
||||
|
||||
function getDefaultProvider(twoFactorProviders) {
|
||||
var keys = Object.keys(twoFactorProviders);
|
||||
var providerType = null;
|
||||
@@ -154,17 +160,31 @@ angular
|
||||
var params;
|
||||
if ($scope.providerType === constants.twoFactorProvider.duo) {
|
||||
params = providers[constants.twoFactorProvider.duo];
|
||||
|
||||
$window.Duo.init({
|
||||
host: params.Host,
|
||||
sig_request: params.Signature,
|
||||
submit_callback: function (theForm) {
|
||||
var sigElement = theForm.querySelector('input[name="sig_response"]');
|
||||
if (sigElement) {
|
||||
$scope.login(sigElement.value);
|
||||
if (platformUtilsService.isSafari()) {
|
||||
var tab = BrowserApi.createNewTab(BrowserApi.getAssetUrl('2fa/index.html'));
|
||||
var tabToSend = BrowserApi.makeTabObject(tab);
|
||||
$timeout(() => {
|
||||
BrowserApi.tabSendMessage(tabToSend, {
|
||||
command: '2faPageData',
|
||||
data: {
|
||||
host: params.Host,
|
||||
signature: params.Signature
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
else {
|
||||
$window.Duo.init({
|
||||
host: params.Host,
|
||||
sig_request: params.Signature,
|
||||
submit_callback: function (theForm) {
|
||||
var sigElement = theForm.querySelector('input[name="sig_response"]');
|
||||
if (sigElement) {
|
||||
$scope.login(sigElement.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
else if ($scope.providerType === constants.twoFactorProvider.u2f) {
|
||||
params = providers[constants.twoFactorProvider.u2f];
|
||||
|
||||
@@ -45,6 +45,11 @@ export class MainController implements ng.IController {
|
||||
tab: msg.tab,
|
||||
details: msg.details,
|
||||
});
|
||||
} else if (msg.command === '2faPageResponse') {
|
||||
$scope.$broadcast('2faPageResponse', {
|
||||
type: msg.type,
|
||||
data: msg.data,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user