mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-30 08:10:34 +01:00
duo connector moved to its own js file
This commit is contained in:
parent
d832031cec
commit
a6f8e1b9a3
2
dist/.publish
vendored
2
dist/.publish
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 1990d717ea8706eeab2a194b27b1776ed509330e
|
Subproject commit fdf74f1027877bd1adfa1d3325722e5da9afcb2d
|
@ -71,6 +71,7 @@ gulp.task('min:js', ['clean:js'], function () {
|
|||||||
'!' + paths.minJs,
|
'!' + paths.minJs,
|
||||||
'!' + paths.jsDir + 'fallback*.js',
|
'!' + paths.jsDir + 'fallback*.js',
|
||||||
'!' + paths.jsDir + 'u2f-connector.js',
|
'!' + paths.jsDir + 'u2f-connector.js',
|
||||||
|
'!' + paths.jsDir + 'duo-connector.js',
|
||||||
'!' + paths.jsDir + 'duo.js',
|
'!' + paths.jsDir + 'duo.js',
|
||||||
'!' + paths.jsDir + 'settings.js'
|
'!' + paths.jsDir + 'settings.js'
|
||||||
], { base: '.' })
|
], { base: '.' })
|
||||||
@ -335,6 +336,10 @@ gulp.task('dist:move', function () {
|
|||||||
src: paths.jsDir + 'duo.js',
|
src: paths.jsDir + 'duo.js',
|
||||||
dest: paths.dist + 'js'
|
dest: paths.dist + 'js'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
src: paths.jsDir + 'duo-connector.js',
|
||||||
|
dest: paths.dist + 'js'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
src: paths.jsDir + 'settings.js',
|
src: paths.jsDir + 'settings.js',
|
||||||
dest: paths.dist + 'js'
|
dest: paths.dist + 'js'
|
||||||
|
@ -26,47 +26,6 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="js/duo.js"></script>
|
<script src="js/duo.js"></script>
|
||||||
<script>
|
<script src="js/duo-connector.js"></script>
|
||||||
!(function () {
|
|
||||||
var frameElement = document.createElement('iframe');
|
|
||||||
frameElement.setAttribute('id', 'duo_iframe');
|
|
||||||
setFrameHeight();
|
|
||||||
document.body.appendChild(frameElement);
|
|
||||||
|
|
||||||
var hostParam = getQsParam('host');
|
|
||||||
var requestParam = getQsParam('request');
|
|
||||||
Duo.init({
|
|
||||||
host: hostParam,
|
|
||||||
sig_request: requestParam,
|
|
||||||
submit_callback: function (form) {
|
|
||||||
invokeCSCode(form.elements.sig_response.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.onresize = setFrameHeight;
|
|
||||||
function setFrameHeight() {
|
|
||||||
frameElement.style.height = window.innerHeight + 'px';
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
function getQsParam(name) {
|
|
||||||
var url = window.location.href;
|
|
||||||
name = name.replace(/[\[\]]/g, '\\$&');
|
|
||||||
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
|
|
||||||
results = regex.exec(url);
|
|
||||||
if (!results) return null;
|
|
||||||
if (!results[2]) return '';
|
|
||||||
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
|
||||||
}
|
|
||||||
|
|
||||||
function invokeCSCode(data) {
|
|
||||||
try {
|
|
||||||
invokeCSharpAction(data);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
40
src/js/duo-connector.js
Normal file
40
src/js/duo-connector.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
!(function () {
|
||||||
|
var frameElement = document.createElement('iframe');
|
||||||
|
frameElement.setAttribute('id', 'duo_iframe');
|
||||||
|
setFrameHeight();
|
||||||
|
document.body.appendChild(frameElement);
|
||||||
|
|
||||||
|
var hostParam = getQsParam('host');
|
||||||
|
var requestParam = getQsParam('request');
|
||||||
|
Duo.init({
|
||||||
|
host: hostParam,
|
||||||
|
sig_request: requestParam,
|
||||||
|
submit_callback: function (form) {
|
||||||
|
invokeCSCode(form.elements.sig_response.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.onresize = setFrameHeight;
|
||||||
|
function setFrameHeight() {
|
||||||
|
frameElement.style.height = window.innerHeight + 'px';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
function getQsParam(name) {
|
||||||
|
var url = window.location.href;
|
||||||
|
name = name.replace(/[\[\]]/g, '\\$&');
|
||||||
|
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
|
||||||
|
results = regex.exec(url);
|
||||||
|
if (!results) return null;
|
||||||
|
if (!results[2]) return '';
|
||||||
|
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
function invokeCSCode(data) {
|
||||||
|
try {
|
||||||
|
invokeCSharpAction(data);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user