duo connector moved to its own js file
This commit is contained in:
parent
d832031cec
commit
a6f8e1b9a3
|
@ -1 +1 @@
|
|||
Subproject commit 1990d717ea8706eeab2a194b27b1776ed509330e
|
||||
Subproject commit fdf74f1027877bd1adfa1d3325722e5da9afcb2d
|
|
@ -71,6 +71,7 @@ gulp.task('min:js', ['clean:js'], function () {
|
|||
'!' + paths.minJs,
|
||||
'!' + paths.jsDir + 'fallback*.js',
|
||||
'!' + paths.jsDir + 'u2f-connector.js',
|
||||
'!' + paths.jsDir + 'duo-connector.js',
|
||||
'!' + paths.jsDir + 'duo.js',
|
||||
'!' + paths.jsDir + 'settings.js'
|
||||
], { base: '.' })
|
||||
|
@ -335,6 +336,10 @@ gulp.task('dist:move', function () {
|
|||
src: paths.jsDir + 'duo.js',
|
||||
dest: paths.dist + 'js'
|
||||
},
|
||||
{
|
||||
src: paths.jsDir + 'duo-connector.js',
|
||||
dest: paths.dist + 'js'
|
||||
},
|
||||
{
|
||||
src: paths.jsDir + 'settings.js',
|
||||
dest: paths.dist + 'js'
|
||||
|
|
|
@ -26,47 +26,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<script src="js/duo.js"></script>
|
||||
<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>
|
||||
<script src="js/duo-connector.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -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