mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-10-11 22:47:12 +00:00
Deployed dfc88cc with MkDocs version: 0.16.1
This commit is contained in:
1 parent
dfc88ccfa2
commit
5f7fb2e7c2
155 files changed
+2916
-26539
No files matched your search
@@ -1,18 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
// add.php
|
||||
// Get max. possible quota for a domain when domain field changes
|
||||
$('#addSelectDomain').on('change', function() {
|
||||
$.get("json_api.php", { action:"get_domain_details", object:this.value }, function(data){
|
||||
var result = jQuery.parseJSON( data );
|
||||
max_new_mailbox_quota = ( result.max_new_mailbox_quota / 1048576);
|
||||
if (max_new_mailbox_quota != '0') {
|
||||
$("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
|
||||
$('#addInputQuota').attr({"disabled": false, "value": "", "type": "number", "max": max_new_mailbox_quota});
|
||||
}
|
||||
else {
|
||||
$("#quotaBadge").html('max. ' + max_new_mailbox_quota + ' MiB');
|
||||
$('#addInputQuota').attr({"disabled": true, "value": "", "type": "text", "value": "n/a"});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
// Postfix restrictions, drag and drop functions
|
||||
$( "[id*=srr-sortable]" ).sortable({
|
||||
items: "li:not(.list-heading)",
|
||||
cancel: ".ui-state-disabled",
|
||||
connectWith: "[id*=srr-sortable]",
|
||||
dropOnEmpty: true,
|
||||
placeholder: "ui-state-highlight"
|
||||
});
|
||||
$( "[id*=ssr-sortable]" ).sortable({
|
||||
items: "li:not(.list-heading)",
|
||||
cancel: ".ui-state-disabled",
|
||||
connectWith: "[id*=ssr-sortable]",
|
||||
dropOnEmpty: true,
|
||||
placeholder: "ui-state-highlight"
|
||||
});
|
||||
$('#srr_form').submit(function(){
|
||||
var srr_joined_vals = $("[id^=srr-sortable-active] li").map(function() {
|
||||
return $(this).data("value");
|
||||
}).get().join(', ');
|
||||
var input = $("<input>").attr("type", "hidden").attr("name", "srr_value").val(srr_joined_vals);
|
||||
$('#srr_form').append($(input));
|
||||
});
|
||||
$('#ssr_form').submit(function(){
|
||||
var ssr_joined_vals = $("[id^=ssr-sortable-active] li").map(function() {
|
||||
return $(this).data("value");
|
||||
}).get().join(', ');
|
||||
var input = $("<input>").attr("type", "hidden").attr("name", "ssr_value").val(ssr_joined_vals);
|
||||
$('#ssr_form').append($(input));
|
||||
});
|
||||
});
|
||||
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
/*!
|
||||
* Bootstrap-select v1.12.2 (http://silviomoreto.github.io/bootstrap-select)
|
||||
*
|
||||
* Copyright 2013-2017 bootstrap-select
|
||||
* Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE)
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a){"use strict";function b(b){var c=[{re:/[\xC0-\xC6]/g,ch:"A"},{re:/[\xE0-\xE6]/g,ch:"a"},{re:/[\xC8-\xCB]/g,ch:"E"},{re:/[\xE8-\xEB]/g,ch:"e"},{re:/[\xCC-\xCF]/g,ch:"I"},{re:/[\xEC-\xEF]/g,ch:"i"},{re:/[\xD2-\xD6]/g,ch:"O"},{re:/[\xF2-\xF6]/g,ch:"o"},{re:/[\xD9-\xDC]/g,ch:"U"},{re:/[\xF9-\xFC]/g,ch:"u"},{re:/[\xC7-\xE7]/g,ch:"c"},{re:/[\xD1]/g,ch:"N"},{re:/[\xF1]/g,ch:"n"}];return a.each(c,function(){b=b?b.replace(this.re,this.ch):""}),b}function c(b){var c=arguments,d=b;[].shift.apply(c);var e,f=this.each(function(){var b=a(this);if(b.is("select")){var f=b.data("selectpicker"),g="object"==typeof d&&d;if(f){if(g)for(var h in g)g.hasOwnProperty(h)&&(f.options[h]=g[h])}else{var i=a.extend({},k.DEFAULTS,a.fn.selectpicker.defaults||{},b.data(),g);i.template=a.extend({},k.DEFAULTS.template,a.fn.selectpicker.defaults?a.fn.selectpicker.defaults.template:{},b.data().template,g.template),b.data("selectpicker",f=new k(this,i))}"string"==typeof d&&(e=f[d]instanceof Function?f[d].apply(f,c):f.options[d])}});return"undefined"!=typeof e?e:f}String.prototype.includes||!function(){var a={}.toString,b=function(){try{var a={},b=Object.defineProperty,c=b(a,a,a)&&b}catch(a){}return c}(),c="".indexOf,d=function(b){if(null==this)throw new TypeError;var d=String(this);if(b&&"[object RegExp]"==a.call(b))throw new TypeError;var e=d.length,f=String(b),g=f.length,h=arguments.length>1?arguments[1]:void 0,i=h?Number(h):0;i!=i&&(i=0);var j=Math.min(Math.max(i,0),e);return!(g+j>e)&&c.call(d,f,i)!=-1};b?b(String.prototype,"includes",{value:d,configurable:!0,writable:!0}):String.prototype.includes=d}(),String.prototype.startsWith||!function(){var a=function(){try{var a={},b=Object.defineProperty,c=b(a,a,a)&&b}catch(a){}return c}(),b={}.toString,c=function(a){if(null==this)throw new TypeError;var c=String(this);if(a&&"[object RegExp]"==b.call(a))throw new TypeError;var d=c.length,e=String(a),f=e.length,g=arguments.length>1?arguments[1]:void 0,h=g?Number(g):0;h!=h&&(h=0);var i=Math.min(Math.max(h,0),d);if(f+i>d)return!1;for(var j=-1;++j<f;)if(c.charCodeAt(i+j)!=e.charCodeAt(j))return!1;return!0};a?a(String.prototype,"startsWith",{value:c,configurable:!0,writable:!0}):String.prototype.startsWith=c}(),Object.keys||(Object.keys=function(a,b,c){c=[];for(b in a)c.hasOwnProperty.call(a,b)&&c.push(b);return c});var d={useDefault:!1,_set:a.valHooks.select.set};a.valHooks.select.set=function(b,c){return c&&!d.useDefault&&a(b).data("selected",!0),d._set.apply(this,arguments)};var e=null;a.fn.triggerNative=function(a){var b,c=this[0];c.dispatchEvent?("function"==typeof Event?b=new Event(a,{bubbles:!0}):(b=document.createEvent("Event"),b.initEvent(a,!0,!1)),c.dispatchEvent(b)):c.fireEvent?(b=document.createEventObject(),b.eventType=a,c.fireEvent("on"+a,b)):this.trigger(a)},a.expr.pseudos.icontains=function(b,c,d){var e=a(b),f=(e.data("tokens")||e.text()).toString().toUpperCase();return f.includes(d[3].toUpperCase())},a.expr.pseudos.ibegins=function(b,c,d){var e=a(b),f=(e.data("tokens")||e.text()).toString().toUpperCase();return f.startsWith(d[3].toUpperCase())},a.expr.pseudos.aicontains=function(b,c,d){var e=a(b),f=(e.data("tokens")||e.data("normalizedText")||e.text()).toString().toUpperCase();return f.includes(d[3].toUpperCase())},a.expr.pseudos.aibegins=function(b,c,d){var e=a(b),f=(e.data("tokens")||e.data("normalizedText")||e.text()).toString().toUpperCase();return f.startsWith(d[3].toUpperCase())};var f={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},g={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},h=function(a){var b=function(b){return a[b]},c="(?:"+Object.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}},i=h(f),j=h(g),k=function(b,c){d.useDefault||(a.valHooks.select.set=d._set,d.useDefault=!0),this.$element=a(b),this.$newElement=null,this.$button=null,this.$menu=null,this.$lis=null,this.options=c,null===this.options.title&&(this.options.title=this.$element.attr("title"));var e=this.options.windowPadding;"number"==typeof e&&(this.options.windowPadding=[e,e,e,e]),this.val=k.prototype.val,this.render=k.prototype.render,this.refresh=k.prototype.refresh,this.setStyle=k.prototype.setStyle,this.selectAll=k.prototype.selectAll,this.deselectAll=k.prototype.deselectAll,this.destroy=k.prototype.destroy,this.remove=k.prototype.remove,this.show=k.prototype.show,this.hide=k.prototype.hide,this.init()};k.VERSION="1.12.2",k.DEFAULTS={noneSelectedText:"Nothing selected",noneResultsText:"No results matched {0}",countSelectedText:function(a,b){return 1==a?"{0} item selected":"{0} items selected"},maxOptionsText:function(a,b){return[1==a?"Limit reached ({n} item max)":"Limit reached ({n} items max)",1==b?"Group limit reached ({nLine truncated
|
||||
m.focus());else{var u=a(":focus");u.click(),u.focus(),c.preventDefault(),a(document).data("spaceSelect",!0)}a(document).data("keycount",0)}(/(^9$|27)/.test(c.keyCode.toString(10))&&l&&(o.multiple||o.options.liveSearch)||/(27)/.test(c.keyCode.toString(10))&&!l)&&(o.$menu.parent().removeClass("open"),o.options.container&&o.$newElement.removeClass("open"),o.$button.focus())}},mobile:function(){this.$element.addClass("mobile-device")},refresh:function(){this.$lis=null,this.liObj={},this.reloadLi(),this.render(),this.checkDisabled(),this.liHeight(!0),this.setStyle(),this.setWidth(),this.$lis&&this.$searchbox.trigger("propertychange"),this.$element.trigger("refreshed.bs.select")},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove(),this.$bsContainer?this.$bsContainer.remove():this.$menu.remove(),this.$element.off(".bs.select").removeData("selectpicker").removeClass("bs-select-hidden selectpicker")}};var l=a.fn.selectpicker;a.fn.selectpicker=c,a.fn.selectpicker.Constructor=k,a.fn.selectpicker.noConflict=function(){return a.fn.selectpicker=l,this},a(document).data("keycount",0).on("keydown.bs.select",'.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input',k.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input',function(a){a.stopPropagation()}),a(window).on("load.bs.select.data-api",function(){a(".selectpicker").each(function(){var b=a(this);c.call(b,b.data())})})}(a)});
|
||||
//# sourceMappingURL=bootstrap-select.js.map
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
/*! =======================================================
|
||||
VERSION 9.7.2
|
||||
========================================================= */
|
||||
"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},windowIsDefined="object"===("undefined"==typeof window?"undefined":_typeof(window));!function(a){if("function"==typeof define&&define.amd)define(["jquery"],a);else if("object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports){var b;try{b=require("jquery")}catch(c){b=null}module.exports=a(b)}else window&&(window.Slider=a(window.jQuery))}(function(a){var b="slider",c="bootstrapSlider";windowIsDefined&&!window.console&&(window.console={}),windowIsDefined&&!window.console.log&&(window.console.log=function(){}),windowIsDefined&&!window.console.warn&&(window.console.warn=function(){});var d;return function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l&&l!==k)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}var m=this.map(function(){var d=a.data(this,b);return d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d)),a(this)});return!m||m.length>1?m:m[0]}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;c(a)}(a),function(a){function e(b,c){function d(a,b){var c="data-slider-"+b.replace(/_/g,"-"),d=a.getAttribute(c);try{return JSON.parse(d)}catch(e){return d}}this._state={value:null,enabled:null,offset:null,size:null,percentage:null,inDrag:!1,over:!1},this.ticksCallbackMap={},this.handleCallbackMap={},"string"==typeof b?this.element=document.querySelector(b):b instanceof HTMLElement&&(this.element=b),c=c?c:{};for(var e=Object.keys(this.defaultOptions),f=0;f<e.length;f++){var h=e[f],i=c[h];i="undefined"!=typeof i?i:d(this.element,h),i=null!==i?i:this.defaultOptions[h],this.options||(this.options={}),this.options[h]=i}"auto"===this.options.rtl&&(this.options.rtl="rtl"===window.getComputedStyle(this.element).direction),"vertical"!==this.options.orientation||"top"!==this.options.tooltip_position&&"bottom"!==this.options.tooltip_position?"horizontal"!==this.options.orientation||"left"!==this.options.tooltip_position&&"right"!==this.options.tooltip_position||(this.options.tooltip_position="top"):this.options.rtl?this.options.tooltip_position="left":this.options.tooltip_position="right";var j,k,l,m,n,o=this.element.style.width,p=!1,q=this.element.parentNode;if(this.sliderElem)p=!0;else{this.sliderElem=document.createElement("div"),this.sliderElem.className="slider";var r=document.createElement("div");if(r.className="slider-track",k=document.createElement("div"),k.className="slider-track-low",j=document.createElement("div"),j.className="slider-selection",l=document.createElement("div"),l.className="slider-track-high",m=document.createElement("div"),m.className="slider-handle min-slider-handle",m.setAttribute("role","slider"),m.setAttribute("aria-valuemin",this.options.min),m.setAttribute("aria-valuemax",this.options.max),n=document.createElement("div"),n.className="slider-handle max-slider-handle",n.setAttribute("role","slider"),n.setAttribute("aria-valuemin",this.options.min),n.setAttribute("aria-valuemax",this.options.max),r.appendChild(k),r.appendChild(j),r.appendChild(l),this.rangeHighlightElements=[],Array.isArray(this.options.rangeHighlights)&&this.options.rangeHighlights.length>0)for(var s=0;s<this.options.rangeHighlights.length;s++){var t=document.createElement("div");t.className="slider-rangeHighlight slider-selection",this.rangeHighlightElements.push(t),r.appendChild(t)}var u=Array.isArray(this.options.labelledby);if(u&&this.options.labelledby[0]&&m.setAttribute("aria-labelledby",this.options.labelledby[0]),u&&this.options.labelledby[1]&&n.setAttribute("aria-labelledby",this.options.labelledby[1]),!u&&this.options.labelledby&&(m.setAttribute("aria-labelledby",this.options.labelledby),n.setAttribute("aria-labelledby",this.options.labelledby)),this.ticks=[],Array.isArray(this.options.ticks)&&this.options.ticks.length>0){for(this.ticksContainer=document.createElement("div"),this.ticksContainer.className="slider-tick-container",f=0;f<this.options.ticks.length;f++){var v=document.createElement("div");if(v.className="slider-tick",this.options.ticks_tooltip){var w=this._addTickListener(),x=w.addMouseEnter(this,v,f),y=w.addMouseLeave(this,v);this.ticksCallbackMap[f]={mouseEnter:x,mouseLeave:y}}this.ticks.push(v),this.ticksContainer.appendChild(v)}j.className+=" tick-slider-selection"}if(this.tickLabels=[],Array.isArrLine truncated
|
||||
var e=Math.abs(this.options.ticks[d]-b);e<=c[1]&&(c=[this.options.ticks[d],e])}if(c[1]<=this.options.ticks_snap_bounds)return c[0]}return b},_applyPrecision:function(a){var b=this.options.precision||this._getNumDigitsAfterDecimalPlace(this.options.step);return this._applyToFixedAndParseFloat(a,b)},_getNumDigitsAfterDecimalPlace:function(a){var b=(""+a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return b?Math.max(0,(b[1]?b[1].length:0)-(b[2]?+b[2]:0)):0},_applyToFixedAndParseFloat:function(a,b){var c=a.toFixed(b);return parseFloat(c)},_getPercentage:function(a){!this.touchCapable||"touchstart"!==a.type&&"touchmove"!==a.type||(a=a.touches[0]);var b=a[this.mousePos],c=this._state.offset[this.stylePos],d=b-c;"right"===this.stylePos&&(d=-d);var e=d/this._state.size*100;return e=Math.round(e/this._state.percentage[2])*this._state.percentage[2],this.options.reversed&&(e=100-e),Math.max(0,Math.min(100,e))},_validateInputValue:function(a){if(isNaN(+a)){if(Array.isArray(a))return this._validateArray(a),a;throw new Error(f.formatInvalidInputErrorMsg(a))}return+a},_validateArray:function(a){for(var b=0;b<a.length;b++){var c=a[b];if("number"!=typeof c)throw new Error(f.formatInvalidInputErrorMsg(c))}},_setDataVal:function(a){this.element.setAttribute("data-value",a),this.element.setAttribute("value",a),this.element.value=a},_trigger:function(b,c){c=c||0===c?c:void 0;var d=this.eventToCallbackMap[b];if(d&&d.length)for(var e=0;e<d.length;e++){var f=d[e];f(c)}a&&this._triggerJQueryEvent(b,c)},_triggerJQueryEvent:function(a,b){var c={type:a,value:b};this.$element.trigger(c),this.$sliderElem.trigger(c)},_unbindJQueryEventHandlers:function(){this.$element.off(),this.$sliderElem.off()},_setText:function(a,b){"undefined"!=typeof a.textContent?a.textContent=b:"undefined"!=typeof a.innerText&&(a.innerText=b)},_removeClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)");d=d.replace(g," ")}a.className=d.trim()},_addClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)"),h=g.test(d);h||(d+=" "+f)}a.className=d.trim()},_offsetLeft:function(a){return a.getBoundingClientRect().left},_offsetRight:function(a){return a.getBoundingClientRect().right},_offsetTop:function(a){for(var b=a.offsetTop;(a=a.offsetParent)&&!isNaN(a.offsetTop);)b+=a.offsetTop,"BODY"!==a.tagName&&(b-=a.scrollTop);return b},_offset:function(a){return{left:this._offsetLeft(a),right:this._offsetRight(a),top:this._offsetTop(a)}},_css:function(b,c,d){if(a)a.style(b,c,d);else{var e=c.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(a,b){return b.toUpperCase()});b.style[e]=d}},_toValue:function(a){return this.options.scale.toValue.apply(this,[a])},_toPercentage:function(a){return this.options.scale.toPercentage.apply(this,[a])},_setTooltipPosition:function(){var a=[this.tooltip,this.tooltip_min,this.tooltip_max];if("vertical"===this.options.orientation){var b;b=this.options.tooltip_position?this.options.tooltip_position:this.options.rtl?"left":"right";var c="left"===b?"right":"left";a.forEach(function(a){this._addClass(a,b),a.style[c]="100%"}.bind(this))}else"bottom"===this.options.tooltip_position?a.forEach(function(a){this._addClass(a,"bottom"),a.style.top="22px"}.bind(this)):a.forEach(function(a){this._addClass(a,"top"),a.style.top=-this.tooltip.outerHeight-14+"px"}.bind(this))}},a&&a.fn&&!function(){var e=void 0;a.fn.slider?(windowIsDefined&&window.console.warn("bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSlider namespace instead."),e=c):(a.bridget(b,d),e=b),a.bridget(c,d),a(function(){a("input[data-provide=slider]")[e]()})}()}(a),d});
|
||||
Vendored
-10
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.
|
||||
*
|
||||
* @version v3.3.3
|
||||
* @homepage http://www.bootstrap-switch.org
|
||||
* @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu)
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
'use strict';var _createClass=function(){function a(b,c){for(var e,d=0;d<c.length;d++)e=c[d],e.enumerable=e.enumerable||!1,e.configurable=!0,'value'in e&&(e.writable=!0),Object.defineProperty(b,e.key,e)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}(function(a,b){var c=function(){function d(e){var g=this,f=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,d),this.$element=a(e),this.options=a.extend({},a.fn.bootstrapSwitch.defaults,this._getElementOptions(),f),this.prevOptions={},this.$wrapper=a('<div>',{class:function _class(){var h=[];return h.push(g.options.state?'on':'off'),g.options.size&&h.push(g.options.size),g.options.disabled&&h.push('disabled'),g.options.readonly&&h.push('readonly'),g.options.indeterminate&&h.push('indeterminate'),g.options.inverse&&h.push('inverse'),g.$element.attr('id')&&h.push('id-'+g.$element.attr('id')),h.map(g._getClass.bind(g)).concat([g.options.baseClass],g._getClasses(g.options.wrapperClass)).join(' ')}}),this.$container=a('<div>',{class:this._getClass('container')}),this.$on=a('<span>',{html:this.options.onText,class:this._getClass('handle-on')+' '+this._getClass(this.options.onColor)}),this.$off=a('<span>',{html:this.options.offText,class:this._getClass('handle-off')+' '+this._getClass(this.options.offColor)}),this.$label=a('<span>',{html:this.options.labelText,class:this._getClass('label')}),this.$element.on('init.bootstrapSwitch',this.options.onInit.bind(this,e)),this.$element.on('switchChange.bootstrapSwitch',function(){for(var j=arguments.length,h=Array(j),k=0;k<j;k++)h[k]=arguments[k];!1===g.options.onSwitchChange.apply(e,h)&&(g.$element.is(':radio')?a('[name="'+g.$element.attr('name')+'"]').trigger('previousState.bootstrapSwitch',!0):g.$element.trigger('previousState.bootstrapSwitch',!0))}),this.$container=this.$element.wrap(this.$container).parent(),this.$wrapper=this.$container.wrap(this.$wrapper).parent(),this.$element.before(this.options.inverse?this.$off:this.$on).before(this.$label).before(this.options.inverse?this.$on:this.$off),this.options.indeterminate&&this.$element.prop('indeterminate',!0),this._init(),this._elementHandlers(),this._handleHandlers(),this._labelHandlers(),this._formHandler(),this._externalLabelHandler(),this.$element.trigger('init.bootstrapSwitch',this.options.state)}return _createClass(d,[{key:'setPrevOptions',value:function setPrevOptions(){this.prevOptions=Object.assign({},this.options)}},{key:'state',value:function state(e,f){return'undefined'==typeof e?this.options.state:this.options.disabled||this.options.readonly||this.options.state&&!this.options.radioAllOff&&this.$element.is(':radio')?this.$element:(this.$element.is(':radio')?a('[name="'+this.$element.attr('name')+'"]').trigger('setPreviousOptions.bootstrapSwitch'):this.$element.trigger('setPreviousOptions.bootstrapSwitch'),this.options.indeterminate&&this.indeterminate(!1),this.$element.prop('checked',!!e).trigger('change.bootstrapSwitch',f),this.$element)}},{key:'toggleState',value:function toggleState(e){return this.options.disabled||this.options.readonly?this.$element:this.options.indeterminate?(this.indeterminate(!1),this.state(!0)):this.$element.prop('checked',!this.options.state).trigger('change.bootstrapSwitch',e)}},{key:'size',value:function size(e){return'undefined'==typeof e?this.options.size:(null!=this.options.size&&this.$wrapper.removeClass(this._getClass(this.options.size)),e&&this.$wrapper.addClass(this._getClass(e)),this._width(),this._containerPosition(),this.options.size=e,this.$element)}},{key:'animate',value:function animate(e){return'undefined'==typeof e?this.options.animate:this.options.animate===!!e?this.$element:this.toggleAnimate()}},{key:'toggleAnimate',value:function toggleAnimate(){return this.options.animate=!this.options.animate,this.$wrapper.toggleClass(this._getClass('animate')),this.$element}},{key:'disabled',value:function disabled(e){return'undefined'==typeof e?this.options.disabled:this.options.disabled===!!e?this.$element:this.toggleDisabled()}},{key:'toggleDisabled',value:function toggleDisabled(){return this.options.disabled=!this.options.disabled,this.$element.prop('disabled',this.options.disabled),this.$wrapper.toggleClass(this._getClass('disabled')),this.$element}},{key:'readonly',value:function readonly(e){return'undefined'==typeof e?this.options.readonly:this.options.readonly===!!e?this.$element:this.toggleReadonly()}},{key:'toggleReadonly',value:function toggleReadonly(){return this.options.readonly=!this.options.readonly,this.$element.prop('readonly',this.options.readonly),this.$wrapper.toggleClass(this._getClass('readonly')),this.$element}},{key:'indeterminate',value:function indeterminate(e){return'undefined'==typeof e?this.options.indeterminate:this.options.indeterminate===!!e?this.$element:this.toggleIndeterminate()}},{key:'toggleIndeterminate',value:function toggleIndetermiLine truncated
|
||||
@@ -1,3 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
$('nav').hide();
|
||||
});
|
||||
@@ -1,54 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
// Show element counter for tables
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
var rowCountDomainAlias = $('#domainaliastable >tbody >#data').length;
|
||||
var rowCountDomain = $('#domaintable >tbody >#data').length;
|
||||
var rowCountMailbox = $('#mailboxtable >tbody >#data').length;
|
||||
var rowCountAlias = $('#aliastable >tbody >#data').length;
|
||||
var rowCountResource = $('#resourcetable >tbody >#data').length;
|
||||
$("#numRowsDomainAlias").text(rowCountDomainAlias);
|
||||
$("#numRowsDomain").text(rowCountDomain);
|
||||
$("#numRowsMailbox").text(rowCountMailbox);
|
||||
$("#numRowsAlias").text(rowCountAlias);
|
||||
$("#numRowsResource").text(rowCountResource);
|
||||
|
||||
// Filter table function
|
||||
$.fn.extend({
|
||||
filterTable: function(){
|
||||
return this.each(function(){
|
||||
$(this).on('keyup', function(e){
|
||||
var $this = $(this),
|
||||
search = $this.val().toLowerCase(),
|
||||
target = $this.attr('data-filters'),
|
||||
$target = $(target),
|
||||
$rows = $target.find('tbody #data');
|
||||
$target.find('tbody .filterTable_no_results').remove();
|
||||
if(search == '') {
|
||||
$target.find('tbody #no-data').show();
|
||||
$rows.show();
|
||||
} else {
|
||||
$target.find('tbody #no-data').hide();
|
||||
$rows.each(function(){
|
||||
var $this = $(this);
|
||||
$this.text().toLowerCase().indexOf(search) === -1 ? $this.hide() : $this.show();
|
||||
})
|
||||
if($target.find('tbody #data:visible').size() === 0) {
|
||||
var col_count = $target.find('#data').first().find('td').size();
|
||||
var no_results = $('<tr class="filterTable_no_results"><td colspan="100%">-</td></tr>')
|
||||
$target.find('tbody').prepend(no_results);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
$('[data-action="filter"]').filterTable();
|
||||
$('.container').on('click', '.panel-heading span.filter', function(e){
|
||||
var $this = $(this),
|
||||
$panel = $this.parents('.panel');
|
||||
$panel.find('.panel-body').slideToggle("fast");
|
||||
if($this.css('display') != 'none') {
|
||||
$panel.find('.panel-body input').focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,236 +0,0 @@
|
||||
(function() {
|
||||
var SELECTOR, addEventListener, clickEvents, numberRegExp, sortable, touchDevice, trimRegExp;
|
||||
|
||||
SELECTOR = 'table[data-sortable]';
|
||||
|
||||
numberRegExp = /^-?[£$¤]?[\d,.]+%?$/;
|
||||
|
||||
trimRegExp = /^\s+|\s+$/g;
|
||||
|
||||
clickEvents = ['click'];
|
||||
|
||||
touchDevice = 'ontouchstart' in document.documentElement;
|
||||
|
||||
if (touchDevice) {
|
||||
clickEvents.push('touchstart');
|
||||
}
|
||||
|
||||
addEventListener = function(el, event, handler) {
|
||||
if (el.addEventListener != null) {
|
||||
return el.addEventListener(event, handler, false);
|
||||
} else {
|
||||
return el.attachEvent("on" + event, handler);
|
||||
}
|
||||
};
|
||||
|
||||
sortable = {
|
||||
init: function(options) {
|
||||
var table, tables, _i, _len, _results;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
if (options.selector == null) {
|
||||
options.selector = SELECTOR;
|
||||
}
|
||||
tables = document.querySelectorAll(options.selector);
|
||||
_results = [];
|
||||
for (_i = 0, _len = tables.length; _i < _len; _i++) {
|
||||
table = tables[_i];
|
||||
_results.push(sortable.initTable(table));
|
||||
}
|
||||
return _results;
|
||||
},
|
||||
initTable: function(table) {
|
||||
var i, th, ths, _i, _len, _ref;
|
||||
if (((_ref = table.tHead) != null ? _ref.rows.length : void 0) !== 1) {
|
||||
return;
|
||||
}
|
||||
if (table.getAttribute('data-sortable-initialized') === 'true') {
|
||||
return;
|
||||
}
|
||||
table.setAttribute('data-sortable-initialized', 'true');
|
||||
ths = table.querySelectorAll('th');
|
||||
for (i = _i = 0, _len = ths.length; _i < _len; i = ++_i) {
|
||||
th = ths[i];
|
||||
if (th.getAttribute('data-sortable') !== 'false') {
|
||||
sortable.setupClickableTH(table, th, i);
|
||||
}
|
||||
}
|
||||
return table;
|
||||
},
|
||||
setupClickableTH: function(table, th, i) {
|
||||
var eventName, onClick, type, _i, _len, _results;
|
||||
type = sortable.getColumnType(table, i);
|
||||
onClick = function(e) {
|
||||
var compare, item, newSortedDirection, position, row, rowArray, sorted, sortedDirection, tBody, ths, value, _compare, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1;
|
||||
if (e.handled !== true) {
|
||||
e.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
sorted = this.getAttribute('data-sorted') === 'true';
|
||||
sortedDirection = this.getAttribute('data-sorted-direction');
|
||||
if (sorted) {
|
||||
newSortedDirection = sortedDirection === 'ascending' ? 'descending' : 'ascending';
|
||||
} else {
|
||||
newSortedDirection = type.defaultSortDirection;
|
||||
}
|
||||
ths = this.parentNode.querySelectorAll('th');
|
||||
for (_i = 0, _len = ths.length; _i < _len; _i++) {
|
||||
th = ths[_i];
|
||||
th.setAttribute('data-sorted', 'false');
|
||||
th.removeAttribute('data-sorted-direction');
|
||||
}
|
||||
this.setAttribute('data-sorted', 'true');
|
||||
this.setAttribute('data-sorted-direction', newSortedDirection);
|
||||
tBody = table.tBodies[0];
|
||||
rowArray = [];
|
||||
if (!sorted) {
|
||||
if (type.compare != null) {
|
||||
_compare = type.compare;
|
||||
} else {
|
||||
_compare = function(a, b) {
|
||||
return b - a;
|
||||
};
|
||||
}
|
||||
compare = function(a, b) {
|
||||
if (a[0] === b[0]) {
|
||||
return a[2] - b[2];
|
||||
}
|
||||
if (type.reverse) {
|
||||
return _compare(b[0], a[0]);
|
||||
} else {
|
||||
return _compare(a[0], b[0]);
|
||||
}
|
||||
};
|
||||
_ref = tBody.rows;
|
||||
for (position = _j = 0, _len1 = _ref.length; _j < _len1; position = ++_j) {
|
||||
row = _ref[position];
|
||||
value = sortable.getNodeValue(row.cells[i]);
|
||||
if (type.comparator != null) {
|
||||
value = type.comparator(value);
|
||||
}
|
||||
rowArray.push([value, row, position]);
|
||||
}
|
||||
rowArray.sort(compare);
|
||||
for (_k = 0, _len2 = rowArray.length; _k < _len2; _k++) {
|
||||
row = rowArray[_k];
|
||||
tBody.appendChild(row[1]);
|
||||
}
|
||||
} else {
|
||||
_ref1 = tBody.rows;
|
||||
for (_l = 0, _len3 = _ref1.length; _l < _len3; _l++) {
|
||||
item = _ref1[_l];
|
||||
rowArray.push(item);
|
||||
}
|
||||
rowArray.reverse();
|
||||
for (_m = 0, _len4 = rowArray.length; _m < _len4; _m++) {
|
||||
row = rowArray[_m];
|
||||
tBody.appendChild(row);
|
||||
}
|
||||
}
|
||||
if (typeof window['CustomEvent'] === 'function') {
|
||||
return typeof table.dispatchEvent === "function" ? table.dispatchEvent(new CustomEvent('Sortable.sorted', {
|
||||
bubbles: true
|
||||
})) : void 0;
|
||||
}
|
||||
};
|
||||
_results = [];
|
||||
for (_i = 0, _len = clickEvents.length; _i < _len; _i++) {
|
||||
eventName = clickEvents[_i];
|
||||
_results.push(addEventListener(th, eventName, onClick));
|
||||
}
|
||||
return _results;
|
||||
},
|
||||
getColumnType: function(table, i) {
|
||||
var row, specified, text, type, _i, _j, _len, _len1, _ref, _ref1, _ref2;
|
||||
specified = (_ref = table.querySelectorAll('th')[i]) != null ? _ref.getAttribute('data-sortable-type') : void 0;
|
||||
if (specified != null) {
|
||||
return sortable.typesObject[specified];
|
||||
}
|
||||
_ref1 = table.tBodies[0].rows;
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
row = _ref1[_i];
|
||||
text = sortable.getNodeValue(row.cells[i]);
|
||||
_ref2 = sortable.types;
|
||||
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
||||
type = _ref2[_j];
|
||||
if (type.match(text)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sortable.typesObject.alpha;
|
||||
},
|
||||
getNodeValue: function(node) {
|
||||
var dataValue;
|
||||
if (!node) {
|
||||
return '';
|
||||
}
|
||||
dataValue = node.getAttribute('data-value');
|
||||
if (dataValue !== null) {
|
||||
return dataValue;
|
||||
}
|
||||
if (typeof node.innerText !== 'undefined') {
|
||||
return node.innerText.replace(trimRegExp, '');
|
||||
}
|
||||
return node.textContent.replace(trimRegExp, '');
|
||||
},
|
||||
setupTypes: function(types) {
|
||||
var type, _i, _len, _results;
|
||||
sortable.types = types;
|
||||
sortable.typesObject = {};
|
||||
_results = [];
|
||||
for (_i = 0, _len = types.length; _i < _len; _i++) {
|
||||
type = types[_i];
|
||||
_results.push(sortable.typesObject[type.name] = type);
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
};
|
||||
|
||||
sortable.setupTypes([
|
||||
{
|
||||
name: 'numeric',
|
||||
defaultSortDirection: 'descending',
|
||||
match: function(a) {
|
||||
return a.match(numberRegExp);
|
||||
},
|
||||
comparator: function(a) {
|
||||
return parseFloat(a.replace(/[^0-9.-]/g, ''), 10) || 0;
|
||||
}
|
||||
}, {
|
||||
name: 'date',
|
||||
defaultSortDirection: 'ascending',
|
||||
reverse: true,
|
||||
match: function(a) {
|
||||
return !isNaN(Date.parse(a));
|
||||
},
|
||||
comparator: function(a) {
|
||||
return Date.parse(a) || 0;
|
||||
}
|
||||
}, {
|
||||
name: 'alpha',
|
||||
defaultSortDirection: 'ascending',
|
||||
match: function() {
|
||||
return true;
|
||||
},
|
||||
compare: function(a, b) {
|
||||
return a.localeCompare(b);
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
setTimeout(sortable.init, 0);
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function() {
|
||||
return sortable;
|
||||
});
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
module.exports = sortable;
|
||||
} else {
|
||||
window.Sortable = sortable;
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
@@ -1,651 +0,0 @@
|
||||
// Copyright 2014-2015 Google Inc. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
/**
|
||||
* @fileoverview The U2F api.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/** Namespace for the U2F api.
|
||||
* @type {Object}
|
||||
*/
|
||||
var u2f = u2f || {};
|
||||
|
||||
/**
|
||||
* The U2F extension id
|
||||
* @type {string}
|
||||
* @const
|
||||
*/
|
||||
u2f.EXTENSION_ID = 'kmendfapggjehodndflmmgagdbamhnfd';
|
||||
|
||||
/**
|
||||
* Message types for messsages to/from the extension
|
||||
* @const
|
||||
* @enum {string}
|
||||
*/
|
||||
u2f.MessageTypes = {
|
||||
'U2F_REGISTER_REQUEST': 'u2f_register_request',
|
||||
'U2F_SIGN_REQUEST': 'u2f_sign_request',
|
||||
'U2F_REGISTER_RESPONSE': 'u2f_register_response',
|
||||
'U2F_SIGN_RESPONSE': 'u2f_sign_response'
|
||||
};
|
||||
|
||||
/**
|
||||
* Response status codes
|
||||
* @const
|
||||
* @enum {number}
|
||||
*/
|
||||
u2f.ErrorCodes = {
|
||||
'OK': 0,
|
||||
'OTHER_ERROR': 1,
|
||||
'BAD_REQUEST': 2,
|
||||
'CONFIGURATION_UNSUPPORTED': 3,
|
||||
'DEVICE_INELIGIBLE': 4,
|
||||
'TIMEOUT': 5
|
||||
};
|
||||
|
||||
/**
|
||||
* A message type for registration requests
|
||||
* @typedef {{
|
||||
* type: u2f.MessageTypes,
|
||||
* signRequests: Array<u2f.SignRequest>,
|
||||
* registerRequests: ?Array<u2f.RegisterRequest>,
|
||||
* timeoutSeconds: ?number,
|
||||
* requestId: ?number
|
||||
* }}
|
||||
*/
|
||||
u2f.Request;
|
||||
|
||||
/**
|
||||
* A message for registration responses
|
||||
* @typedef {{
|
||||
* type: u2f.MessageTypes,
|
||||
* responseData: (u2f.Error | u2f.RegisterResponse | u2f.SignResponse),
|
||||
* requestId: ?number
|
||||
* }}
|
||||
*/
|
||||
u2f.Response;
|
||||
|
||||
/**
|
||||
* An error object for responses
|
||||
* @typedef {{
|
||||
* errorCode: u2f.ErrorCodes,
|
||||
* errorMessage: ?string
|
||||
* }}
|
||||
*/
|
||||
u2f.Error;
|
||||
|
||||
/**
|
||||
* Data object for a single sign request.
|
||||
* @typedef {{
|
||||
* version: string,
|
||||
* challenge: string,
|
||||
* keyHandle: string,
|
||||
* appId: string
|
||||
* }}
|
||||
*/
|
||||
u2f.SignRequest;
|
||||
|
||||
/**
|
||||
* Data object for a sign response.
|
||||
* @typedef {{
|
||||
* keyHandle: string,
|
||||
* signatureData: string,
|
||||
* clientData: string
|
||||
* }}
|
||||
*/
|
||||
u2f.SignResponse;
|
||||
|
||||
/**
|
||||
* Data object for a registration request.
|
||||
* @typedef {{
|
||||
* version: string,
|
||||
* challenge: string,
|
||||
* appId: string
|
||||
* }}
|
||||
*/
|
||||
u2f.RegisterRequest;
|
||||
|
||||
/**
|
||||
* Data object for a registration response.
|
||||
* @typedef {{
|
||||
* registrationData: string,
|
||||
* clientData: string
|
||||
* }}
|
||||
*/
|
||||
u2f.RegisterResponse;
|
||||
|
||||
|
||||
// Low level MessagePort API support
|
||||
|
||||
/**
|
||||
* Sets up a MessagePort to the U2F extension using the
|
||||
* available mechanisms.
|
||||
* @param {function((MessagePort|u2f.WrappedChromeRuntimePort_))} callback
|
||||
*/
|
||||
u2f.getMessagePort = function(callback) {
|
||||
if (typeof chrome != 'undefined' && chrome.runtime) {
|
||||
// The actual message here does not matter, but we need to get a reply
|
||||
// for the callback to run. Thus, send an empty signature request
|
||||
// in order to get a failure response.
|
||||
var msg = {
|
||||
type: u2f.MessageTypes.U2F_SIGN_REQUEST,
|
||||
signRequests: []
|
||||
};
|
||||
chrome.runtime.sendMessage(u2f.EXTENSION_ID, msg, function() {
|
||||
if (!chrome.runtime.lastError) {
|
||||
// We are on a whitelisted origin and can talk directly
|
||||
// with the extension.
|
||||
u2f.getChromeRuntimePort_(callback);
|
||||
} else {
|
||||
// chrome.runtime was available, but we couldn't message
|
||||
// the extension directly, use iframe
|
||||
u2f.getIframePort_(callback);
|
||||
}
|
||||
});
|
||||
} else if (u2f.isAndroidChrome_()) {
|
||||
u2f.getAuthenticatorPort_(callback);
|
||||
} else {
|
||||
// chrome.runtime was not available at all, which is normal
|
||||
// when this origin doesn't have access to any extensions.
|
||||
u2f.getIframePort_(callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Detect chrome running on android based on the browser's useragent.
|
||||
* @private
|
||||
*/
|
||||
u2f.isAndroidChrome_ = function() {
|
||||
var userAgent = navigator.userAgent;
|
||||
return userAgent.indexOf('Chrome') != -1 &&
|
||||
userAgent.indexOf('Android') != -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Connects directly to the extension via chrome.runtime.connect
|
||||
* @param {function(u2f.WrappedChromeRuntimePort_)} callback
|
||||
* @private
|
||||
*/
|
||||
u2f.getChromeRuntimePort_ = function(callback) {
|
||||
var port = chrome.runtime.connect(u2f.EXTENSION_ID,
|
||||
{'includeTlsChannelId': true});
|
||||
setTimeout(function() {
|
||||
callback(new u2f.WrappedChromeRuntimePort_(port));
|
||||
}, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a 'port' abstraction to the Authenticator app.
|
||||
* @param {function(u2f.WrappedAuthenticatorPort_)} callback
|
||||
* @private
|
||||
*/
|
||||
u2f.getAuthenticatorPort_ = function(callback) {
|
||||
setTimeout(function() {
|
||||
callback(new u2f.WrappedAuthenticatorPort_());
|
||||
}, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* A wrapper for chrome.runtime.Port that is compatible with MessagePort.
|
||||
* @param {Port} port
|
||||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
u2f.WrappedChromeRuntimePort_ = function(port) {
|
||||
this.port_ = port;
|
||||
};
|
||||
|
||||
/**
|
||||
* Format a return a sign request.
|
||||
* @param {Array<u2f.SignRequest>} signRequests
|
||||
* @param {number} timeoutSeconds
|
||||
* @param {number} reqId
|
||||
* @return {Object}
|
||||
*/
|
||||
u2f.WrappedChromeRuntimePort_.prototype.formatSignRequest_ =
|
||||
function(signRequests, timeoutSeconds, reqId) {
|
||||
return {
|
||||
type: u2f.MessageTypes.U2F_SIGN_REQUEST,
|
||||
signRequests: signRequests,
|
||||
timeoutSeconds: timeoutSeconds,
|
||||
requestId: reqId
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Format a return a register request.
|
||||
* @param {Array<u2f.SignRequest>} signRequests
|
||||
* @param {Array<u2f.RegisterRequest>} signRequests
|
||||
* @param {number} timeoutSeconds
|
||||
* @param {number} reqId
|
||||
* @return {Object}
|
||||
*/
|
||||
u2f.WrappedChromeRuntimePort_.prototype.formatRegisterRequest_ =
|
||||
function(signRequests, registerRequests, timeoutSeconds, reqId) {
|
||||
return {
|
||||
type: u2f.MessageTypes.U2F_REGISTER_REQUEST,
|
||||
signRequests: signRequests,
|
||||
registerRequests: registerRequests,
|
||||
timeoutSeconds: timeoutSeconds,
|
||||
requestId: reqId
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Posts a message on the underlying channel.
|
||||
* @param {Object} message
|
||||
*/
|
||||
u2f.WrappedChromeRuntimePort_.prototype.postMessage = function(message) {
|
||||
this.port_.postMessage(message);
|
||||
};
|
||||
|
||||
/**
|
||||
* Emulates the HTML 5 addEventListener interface. Works only for the
|
||||
* onmessage event, which is hooked up to the chrome.runtime.Port.onMessage.
|
||||
* @param {string} eventName
|
||||
* @param {function({data: Object})} handler
|
||||
*/
|
||||
u2f.WrappedChromeRuntimePort_.prototype.addEventListener =
|
||||
function(eventName, handler) {
|
||||
var name = eventName.toLowerCase();
|
||||
if (name == 'message' || name == 'onmessage') {
|
||||
this.port_.onMessage.addListener(function(message) {
|
||||
// Emulate a minimal MessageEvent object
|
||||
handler({'data': message});
|
||||
});
|
||||
} else {
|
||||
console.error('WrappedChromeRuntimePort only supports onMessage');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Wrap the Authenticator app with a MessagePort interface.
|
||||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
u2f.WrappedAuthenticatorPort_ = function() {
|
||||
this.requestId_ = -1;
|
||||
this.requestObject_ = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch the Authenticator intent.
|
||||
* @param {Object} message
|
||||
*/
|
||||
u2f.WrappedAuthenticatorPort_.prototype.postMessage = function(message) {
|
||||
var intentLocation = /** @type {string} */ (message);
|
||||
document.location = intentLocation;
|
||||
};
|
||||
|
||||
/**
|
||||
* Emulates the HTML 5 addEventListener interface.
|
||||
* @param {string} eventName
|
||||
* @param {function({data: Object})} handler
|
||||
*/
|
||||
u2f.WrappedAuthenticatorPort_.prototype.addEventListener =
|
||||
function(eventName, handler) {
|
||||
var name = eventName.toLowerCase();
|
||||
if (name == 'message') {
|
||||
var self = this;
|
||||
/* Register a callback to that executes when
|
||||
* chrome injects the response. */
|
||||
window.addEventListener(
|
||||
'message', self.onRequestUpdate_.bind(self, handler), false);
|
||||
} else {
|
||||
console.error('WrappedAuthenticatorPort only supports message');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback invoked when a response is received from the Authenticator.
|
||||
* @param function({data: Object}) callback
|
||||
* @param {Object} message message Object
|
||||
*/
|
||||
u2f.WrappedAuthenticatorPort_.prototype.onRequestUpdate_ =
|
||||
function(callback, message) {
|
||||
var messageObject = JSON.parse(message.data);
|
||||
var intentUrl = messageObject['intentURL'];
|
||||
|
||||
var errorCode = messageObject['errorCode'];
|
||||
var responseObject = null;
|
||||
if (messageObject.hasOwnProperty('data')) {
|
||||
responseObject = /** @type {Object} */ (
|
||||
JSON.parse(messageObject['data']));
|
||||
responseObject['requestId'] = this.requestId_;
|
||||
}
|
||||
|
||||
/* Sign responses from the authenticator do not conform to U2F,
|
||||
* convert to U2F here. */
|
||||
responseObject = this.doResponseFixups_(responseObject);
|
||||
callback({'data': responseObject});
|
||||
};
|
||||
|
||||
/**
|
||||
* Fixup the response provided by the Authenticator to conform with
|
||||
* the U2F spec.
|
||||
* @param {Object} responseData
|
||||
* @return {Object} the U2F compliant response object
|
||||
*/
|
||||
u2f.WrappedAuthenticatorPort_.prototype.doResponseFixups_ =
|
||||
function(responseObject) {
|
||||
if (responseObject.hasOwnProperty('responseData')) {
|
||||
return responseObject;
|
||||
} else if (this.requestObject_['type'] != u2f.MessageTypes.U2F_SIGN_REQUEST) {
|
||||
// Only sign responses require fixups. If this is not a response
|
||||
// to a sign request, then an internal error has occurred.
|
||||
return {
|
||||
'type': u2f.MessageTypes.U2F_REGISTER_RESPONSE,
|
||||
'responseData': {
|
||||
'errorCode': u2f.ErrorCodes.OTHER_ERROR,
|
||||
'errorMessage': 'Internal error: invalid response from Authenticator'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* Non-conformant sign response, do fixups. */
|
||||
var encodedChallengeObject = responseObject['challenge'];
|
||||
if (typeof encodedChallengeObject !== 'undefined') {
|
||||
var challengeObject = JSON.parse(atob(encodedChallengeObject));
|
||||
var serverChallenge = challengeObject['challenge'];
|
||||
var challengesList = this.requestObject_['signData'];
|
||||
var requestChallengeObject = null;
|
||||
for (var i = 0; i < challengesList.length; i++) {
|
||||
var challengeObject = challengesList[i];
|
||||
if (challengeObject['keyHandle'] == responseObject['keyHandle']) {
|
||||
requestChallengeObject = challengeObject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var responseData = {
|
||||
'errorCode': responseObject['resultCode'],
|
||||
'keyHandle': responseObject['keyHandle'],
|
||||
'signatureData': responseObject['signature'],
|
||||
'clientData': encodedChallengeObject
|
||||
};
|
||||
return {
|
||||
'type': u2f.MessageTypes.U2F_SIGN_RESPONSE,
|
||||
'responseData': responseData,
|
||||
'requestId': responseObject['requestId']
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Base URL for intents to Authenticator.
|
||||
* @const
|
||||
* @private
|
||||
*/
|
||||
u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_ =
|
||||
'intent:#Intent;action=com.google.android.apps.authenticator.AUTHENTICATE';
|
||||
|
||||
/**
|
||||
* Format a return a sign request.
|
||||
* @param {Array<u2f.SignRequest>} signRequests
|
||||
* @param {number} timeoutSeconds (ignored for now)
|
||||
* @param {number} reqId
|
||||
* @return {string}
|
||||
*/
|
||||
u2f.WrappedAuthenticatorPort_.prototype.formatSignRequest_ =
|
||||
function(signRequests, timeoutSeconds, reqId) {
|
||||
if (!signRequests || signRequests.length == 0) {
|
||||
return null;
|
||||
}
|
||||
/* TODO(fixme): stash away requestId, as the authenticator app does
|
||||
* not return it for sign responses. */
|
||||
this.requestId_ = reqId;
|
||||
/* TODO(fixme): stash away the signRequests, to deal with the legacy
|
||||
* response format returned by the Authenticator app. */
|
||||
this.requestObject_ = {
|
||||
'type': u2f.MessageTypes.U2F_SIGN_REQUEST,
|
||||
'signData': signRequests,
|
||||
'requestId': reqId,
|
||||
'timeout': timeoutSeconds
|
||||
};
|
||||
|
||||
var appId = signRequests[0]['appId'];
|
||||
var intentUrl =
|
||||
u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_ +
|
||||
';S.appId=' + encodeURIComponent(appId) +
|
||||
';S.eventId=' + reqId +
|
||||
';S.challenges=' +
|
||||
encodeURIComponent(
|
||||
JSON.stringify(this.getBrowserDataList_(signRequests))) + ';end';
|
||||
return intentUrl;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the browser data objects from the challenge list
|
||||
* @param {Array} challenges list of challenges
|
||||
* @return {Array} list of browser data objects
|
||||
* @private
|
||||
*/
|
||||
u2f.WrappedAuthenticatorPort_
|
||||
.prototype.getBrowserDataList_ = function(challenges) {
|
||||
return challenges
|
||||
.map(function(challenge) {
|
||||
var browserData = {
|
||||
'typ': 'navigator.id.getAssertion',
|
||||
'challenge': challenge['challenge']
|
||||
};
|
||||
var challengeObject = {
|
||||
'challenge' : browserData,
|
||||
'keyHandle' : challenge['keyHandle']
|
||||
};
|
||||
return challengeObject;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Format a return a register request.
|
||||
* @param {Array<u2f.SignRequest>} signRequests
|
||||
* @param {Array<u2f.RegisterRequest>} enrollChallenges
|
||||
* @param {number} timeoutSeconds (ignored for now)
|
||||
* @param {number} reqId
|
||||
* @return {Object}
|
||||
*/
|
||||
u2f.WrappedAuthenticatorPort_.prototype.formatRegisterRequest_ =
|
||||
function(signRequests, enrollChallenges, timeoutSeconds, reqId) {
|
||||
if (!enrollChallenges || enrollChallenges.length == 0) {
|
||||
return null;
|
||||
}
|
||||
// Assume the appId is the same for all enroll challenges.
|
||||
var appId = enrollChallenges[0]['appId'];
|
||||
var registerRequests = [];
|
||||
for (var i = 0; i < enrollChallenges.length; i++) {
|
||||
var registerRequest = {
|
||||
'challenge': enrollChallenges[i]['challenge'],
|
||||
'version': enrollChallenges[i]['version']
|
||||
};
|
||||
if (enrollChallenges[i]['appId'] != appId) {
|
||||
// Only include the appId when it differs from the first appId.
|
||||
registerRequest['appId'] = enrollChallenges[i]['appId'];
|
||||
}
|
||||
registerRequests.push(registerRequest);
|
||||
}
|
||||
var registeredKeys = [];
|
||||
if (signRequests) {
|
||||
for (i = 0; i < signRequests.length; i++) {
|
||||
var key = {
|
||||
'keyHandle': signRequests[i]['keyHandle'],
|
||||
'version': signRequests[i]['version']
|
||||
};
|
||||
// Only include the appId when it differs from the appId that's
|
||||
// being registered now.
|
||||
if (signRequests[i]['appId'] != appId) {
|
||||
key['appId'] = signRequests[i]['appId'];
|
||||
}
|
||||
registeredKeys.push(key);
|
||||
}
|
||||
}
|
||||
var request = {
|
||||
'type': u2f.MessageTypes.U2F_REGISTER_REQUEST,
|
||||
'appId': appId,
|
||||
'registerRequests': registerRequests,
|
||||
'registeredKeys': registeredKeys,
|
||||
'requestId': reqId,
|
||||
'timeoutSeconds': timeoutSeconds
|
||||
};
|
||||
var intentUrl =
|
||||
u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_ +
|
||||
';S.request=' + encodeURIComponent(JSON.stringify(request)) +
|
||||
';end';
|
||||
/* TODO(fixme): stash away requestId, this is is not necessary for
|
||||
* register requests, but here to keep parity with sign.
|
||||
*/
|
||||
this.requestId_ = reqId;
|
||||
return intentUrl;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Sets up an embedded trampoline iframe, sourced from the extension.
|
||||
* @param {function(MessagePort)} callback
|
||||
* @private
|
||||
*/
|
||||
u2f.getIframePort_ = function(callback) {
|
||||
// Create the iframe
|
||||
var iframeOrigin = 'chrome-extension://' + u2f.EXTENSION_ID;
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.src = iframeOrigin + '/u2f-comms.html';
|
||||
iframe.setAttribute('style', 'display:none');
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
var channel = new MessageChannel();
|
||||
var ready = function(message) {
|
||||
if (message.data == 'ready') {
|
||||
channel.port1.removeEventListener('message', ready);
|
||||
callback(channel.port1);
|
||||
} else {
|
||||
console.error('First event on iframe port was not "ready"');
|
||||
}
|
||||
};
|
||||
channel.port1.addEventListener('message', ready);
|
||||
channel.port1.start();
|
||||
|
||||
iframe.addEventListener('load', function() {
|
||||
// Deliver the port to the iframe and initialize
|
||||
iframe.contentWindow.postMessage('init', iframeOrigin, [channel.port2]);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// High-level JS API
|
||||
|
||||
/**
|
||||
* Default extension response timeout in seconds.
|
||||
* @const
|
||||
*/
|
||||
u2f.EXTENSION_TIMEOUT_SEC = 30;
|
||||
|
||||
/**
|
||||
* A singleton instance for a MessagePort to the extension.
|
||||
* @type {MessagePort|u2f.WrappedChromeRuntimePort_}
|
||||
* @private
|
||||
*/
|
||||
u2f.port_ = null;
|
||||
|
||||
/**
|
||||
* Callbacks waiting for a port
|
||||
* @type {Array<function((MessagePort|u2f.WrappedChromeRuntimePort_))>}
|
||||
* @private
|
||||
*/
|
||||
u2f.waitingForPort_ = [];
|
||||
|
||||
/**
|
||||
* A counter for requestIds.
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
u2f.reqCounter_ = 0;
|
||||
|
||||
/**
|
||||
* A map from requestIds to client callbacks
|
||||
* @type {Object.<number,(function((u2f.Error|u2f.RegisterResponse))
|
||||
* |function((u2f.Error|u2f.SignResponse)))>}
|
||||
* @private
|
||||
*/
|
||||
u2f.callbackMap_ = {};
|
||||
|
||||
/**
|
||||
* Creates or retrieves the MessagePort singleton to use.
|
||||
* @param {function((MessagePort|u2f.WrappedChromeRuntimePort_))} callback
|
||||
* @private
|
||||
*/
|
||||
u2f.getPortSingleton_ = function(callback) {
|
||||
if (u2f.port_) {
|
||||
callback(u2f.port_);
|
||||
} else {
|
||||
if (u2f.waitingForPort_.length == 0) {
|
||||
u2f.getMessagePort(function(port) {
|
||||
u2f.port_ = port;
|
||||
u2f.port_.addEventListener('message',
|
||||
/** @type {function(Event)} */ (u2f.responseHandler_));
|
||||
|
||||
// Careful, here be async callbacks. Maybe.
|
||||
while (u2f.waitingForPort_.length)
|
||||
u2f.waitingForPort_.shift()(u2f.port_);
|
||||
});
|
||||
}
|
||||
u2f.waitingForPort_.push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles response messages from the extension.
|
||||
* @param {MessageEvent.<u2f.Response>} message
|
||||
* @private
|
||||
*/
|
||||
u2f.responseHandler_ = function(message) {
|
||||
var response = message.data;
|
||||
var reqId = response['requestId'];
|
||||
if (!reqId || !u2f.callbackMap_[reqId]) {
|
||||
console.error('Unknown or missing requestId in response.');
|
||||
return;
|
||||
}
|
||||
var cb = u2f.callbackMap_[reqId];
|
||||
delete u2f.callbackMap_[reqId];
|
||||
cb(response['responseData']);
|
||||
};
|
||||
|
||||
/**
|
||||
* Dispatches an array of sign requests to available U2F tokens.
|
||||
* @param {Array<u2f.SignRequest>} signRequests
|
||||
* @param {function((u2f.Error|u2f.SignResponse))} callback
|
||||
* @param {number=} opt_timeoutSeconds
|
||||
*/
|
||||
u2f.sign = function(signRequests, callback, opt_timeoutSeconds) {
|
||||
u2f.getPortSingleton_(function(port) {
|
||||
var reqId = ++u2f.reqCounter_;
|
||||
u2f.callbackMap_[reqId] = callback;
|
||||
var timeoutSeconds = (typeof opt_timeoutSeconds !== 'undefined' ?
|
||||
opt_timeoutSeconds : u2f.EXTENSION_TIMEOUT_SEC);
|
||||
var req = port.formatSignRequest_(signRequests, timeoutSeconds, reqId);
|
||||
port.postMessage(req);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Dispatches register requests to available U2F tokens. An array of sign
|
||||
* requests identifies already registered tokens.
|
||||
* @param {Array<u2f.RegisterRequest>} registerRequests
|
||||
* @param {Array<u2f.SignRequest>} signRequests
|
||||
* @param {function((u2f.Error|u2f.RegisterResponse))} callback
|
||||
* @param {number=} opt_timeoutSeconds
|
||||
*/
|
||||
u2f.register = function(registerRequests, signRequests,
|
||||
callback, opt_timeoutSeconds) {
|
||||
u2f.getPortSingleton_(function(port) {
|
||||
var reqId = ++u2f.reqCounter_;
|
||||
u2f.callbackMap_[reqId] = callback;
|
||||
var timeoutSeconds = (typeof opt_timeoutSeconds !== 'undefined' ?
|
||||
opt_timeoutSeconds : u2f.EXTENSION_TIMEOUT_SEC);
|
||||
var req = port.formatRegisterRequest_(
|
||||
signRequests, registerRequests, timeoutSeconds, reqId);
|
||||
port.postMessage(req);
|
||||
});
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
// Show and activate password fields after box was checked
|
||||
// Hidden by default
|
||||
if ( !$("#togglePwNew").is(':checked') ) {
|
||||
$(".passFields").hide();
|
||||
}
|
||||
$('#togglePwNew').click(function() {
|
||||
$("#user_new_pass").attr("disabled", !this.checked);
|
||||
$("#user_new_pass2").attr("disabled", !this.checked);
|
||||
var $this = $(this);
|
||||
if ($this.is(':checked')) {
|
||||
$(".passFields").slideDown();
|
||||
} else {
|
||||
$(".passFields").slideUp();
|
||||
}
|
||||
});
|
||||
// Show generate button after time selection
|
||||
$('#generate_tla').hide();
|
||||
$('#validity').change(function(){
|
||||
$('#generate_tla').show();
|
||||
});
|
||||
|
||||
// Init Bootstrap Switch
|
||||
$.fn.bootstrapSwitch.defaults.onColor = 'success';
|
||||
$("[name='tls_out']").bootstrapSwitch();
|
||||
$("[name='tls_in']").bootstrapSwitch();
|
||||
|
||||
// Log modal
|
||||
$('#logModal').on('show.bs.modal', function(e) {
|
||||
var logText = $(e.relatedTarget).data('log-text');
|
||||
$(e.currentTarget).find('#logText').html('<pre style="background:none;font-size:11px;line-height:1.1;border:0px">' + logText + '</pre>');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user