fixes for duo login on safari

This commit is contained in:
Kyle Spearrin 2018-01-18 15:07:53 -05:00
parent a3d3aac8be
commit 35385b8c98
3 changed files with 8 additions and 3 deletions

View File

@ -22,18 +22,18 @@ document.addEventListener('DOMContentLoaded', () => {
host: msg.data.host, host: msg.data.host,
sig_request: msg.data.signature, sig_request: msg.data.signature,
submit_callback: (theForm: Document) => { submit_callback: (theForm: Document) => {
const sigElement = theForm.querySelector('input[name="sig_response"]'); const sigElement = theForm.querySelector('input[name="sig_response"]') as HTMLInputElement;
if (sigElement) { if (sigElement) {
safari.self.tab.dispatchMessage('bitwarden', { safari.self.tab.dispatchMessage('bitwarden', {
command: '2faPageResponse', command: '2faPageResponse',
type: 'duo', type: 'duo',
data: { data: {
sigValue: sigElement.nodeValue, sigValue: sigElement.value,
}, },
}); });
window.close(); window.close();
} }
} },
}); });
} else { } else {
// TODO: others like u2f? // TODO: others like u2f?

View File

@ -123,6 +123,8 @@ angular
}); });
$scope.$on('2faPageResponse', (event, details) => { $scope.$on('2faPageResponse', (event, details) => {
console.log('got 2fa response');
console.log(details);
if (details.type === 'duo') { if (details.type === 'duo') {
$scope.login(details.data.sigValue); $scope.login(details.data.sigValue);
} }
@ -167,6 +169,7 @@ angular
BrowserApi.tabSendMessage(tabToSend, { BrowserApi.tabSendMessage(tabToSend, {
command: '2faPageData', command: '2faPageData',
data: { data: {
type: 'duo',
host: params.Host, host: params.Host,
signature: params.Signature signature: params.Signature
} }

View File

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