mirror of
https://github.com/bitwarden/web
synced 2025-12-06 00:03:28 +00:00
2 lines
5.2 KiB
JavaScript
2 lines
5.2 KiB
JavaScript
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1025)}({1025:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(432);function r(e){var t=window.location.href;e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}n(1026),document.addEventListener("DOMContentLoaded",function(e){var t=document.createElement("iframe");t.setAttribute("id","duo_iframe"),a(),document.body.appendChild(t);var n=r("host"),i=r("request");function a(){t.style.height=window.innerHeight+"px"}o.init({iframe:"duo_iframe",host:n,sig_request:i,submit_callback:function(e){!function(e){try{window.invokeCSharpAction(e)}catch(e){}}(e.elements.sig_response.value)}}),window.onresize=a})},1026:function(e,t){},432:function(e,t,n){var o,r,i;r=[],void 0===(i="function"==typeof(o=function(){var e,t,n,o,r,i=/^(?:AUTH|ENROLL)+\|[A-Za-z0-9\+\/=]+\|[A-Za-z0-9\+\/=]+$/,a=/^ERR\|[\w\s\.\(\)]+$/,u=/^DUO_OPEN_WINDOW\|/,s=["duo.com","duosecurity.com","duomobile.s3-us-west-1.amazonaws.com"],c="duo_iframe",d="",f="sig_response";function m(e,t){throw new Error("Duo Web SDK error: "+e+(t?"\nSee "+t+" for more information":""))}function l(e,t){return"dataset"in e?e.dataset[t]:e.getAttribute("data-"+function(e){return e.replace(/([a-z])([A-Z])/,"$1-$2").toLowerCase()}(t))}function p(e,t,n,o){"addEventListener"in window?e.addEventListener(t,o,!1):e.attachEvent(n,o)}function h(e,t,n,o){"removeEventListener"in window?e.removeEventListener(t,o,!1):e.detachEvent(n,o)}function g(e){p(document,"DOMContentLoaded","onreadystatechange",e)}function w(e){h(document,"DOMContentLoaded","onreadystatechange",e)}function v(e){if(e){0===e.indexOf("ERR|")&&m(e.split("|")[1]),-1!==e.indexOf(":")&&2===e.split(":").length||m("Duo was given a bad token. This might indicate a configuration problem with one of Duo's client libraries.","https://www.duosecurity.com/docs/duoweb#first-steps");var o=e.split(":");return t=o[0],n=o[1],{sigRequest:e,duoSig:o[0],appSig:o[1]}}}function b(){if(!(o=document.getElementById(c)))throw new Error('This page does not contain an iframe for Duo to use.Add an element like <iframe id="duo_iframe"></iframe> to this page. See https://www.duosecurity.com/docs/duoweb#3.-show-the-iframe for more information.');E(),w(b)}function _(t){return Boolean(t.origin==="https://"+e&&"string"==typeof t.data&&(t.data.match(i)||t.data.match(a)||t.data.match(u)))}function y(e){if(_(e))if(e.data.match(u)){var t=e.data.substring("DUO_OPEN_WINDOW|".length);(function(e){if(!e)return!1;var t=document.createElement("a");if(t.href=e,"duotrustedendpoints:"===t.protocol)return!0;if("https:"!==t.protocol)return!1;for(var n=0;n<s.length;n++)if(t.hostname.endsWith("."+s[n])||t.hostname===s[n])return!0;return!1})(t)&&window.open(t,"_self")}else O(e.data),function(e){h(window,"message","onmessage",e)}(y)}function E(){e||(e=l(o,"host"))||m("No API hostname is given for Duo to use. Be sure to pass a `host` parameter to Duo.init, or through the `data-host` attribute on the iframe element.","https://www.duosecurity.com/docs/duoweb#3.-show-the-iframe"),t&&n||(v(l(o,"sigRequest")),t&&n||m("No valid signed request is given. Be sure to give the `sig_request` parameter to Duo.init, or use the `data-sig-request` attribute on the iframe element.","https://www.duosecurity.com/docs/duoweb#3.-show-the-iframe")),""===d&&(d=l(o,"postAction")||d),"sig_response"===f&&(f=l(o,"postArgument")||f),o.src=["https://",e,"/frame/web/v1/auth?tx=",t,"&parent=",encodeURIComponent(document.location.href),"&v=2.6"].join(""),function(e){p(window,"message","onmessage",e)}(y)}function O(e){var t=document.createElement("input");t.type="hidden",t.name=f,t.value=e+":"+n;var i=document.getElementById("duo_form");i||(i=document.createElement("form"),o.parentElement.insertBefore(i,o.nextSibling)),i.method="POST",i.action=d,i.appendChild(t),"function"==typeof r?r.call(null,i):i.submit()}return{init:function t(n){n&&(n.host&&(e=n.host),n.sig_request&&v(n.sig_request),n.post_action&&(d=n.post_action),n.post_argument&&(f=n.post_argument),n.iframe&&(n.iframe.tagName?o=n.iframe:"string"==typeof n.iframe&&(c=n.iframe)),"function"==typeof n.submit_callback&&(r=n.submit_callback)),(o=document.getElementById(c))?E():g(b),w(t)},_onReady:g,_parseSigRequest:v,_isDuoMessage:_,_doPostBack:O}})?o.apply(t,r):o)||(e.exports=i)}});
|
|
//# sourceMappingURL=duo.0c0165861697c9b6f84f.js.map
|