lemonldap-ng/lemonldap-ng-manager/site/htdocs/static/js/2ndfa.min.js
Maxime Besson 2c4d615c2f Fix 2F removal when session ids are hidden (#2483)
We don't need to hide persistent session IDs because they are not
security senstive (hash of login)
2021-03-10 14:02:52 +01:00

1 line
5.2 KiB
JavaScript

(function(){var S,o,d,g,e;e=function(e,t){return $("#msg").html(window.translate(e)),$("#color").removeClass("message-positive message-warning alert-success alert-warning"),$("#color").addClass("message-"+t),"positive"===t&&(t="success"),$("#color").addClass("alert-"+t)},g={_whatToTrace:[function(e,t){return"groupBy=substr("+e+",1)"},function(e,t){return e+"="+t+"*"}]},d={_whatToTrace:function(e,t,n,r){return console.log("overSchema => level",n,"over",r),1===n&&t.length>r?e+"="+t+"*&groupBy=substr("+e+","+(n+r+1)+")":null}},S={dateTitle:["_utime","_startTime","_updateTime"],sfaTitle:["_2fDevices"]},o={home:[]},angular.module("llngSessionsExplorer",["ui.tree","ui.bootstrap","llApp"]).controller("SessionsExplorerCtrl",["$scope","$translator","$location","$q","$http",function(_,t,e,n,i){var p,r,a,f;return _.links=links,_.menulinks=menulinks,_.staticPrefix=staticPrefix,_.scriptname=scriptname,_.formPrefix=formPrefix,_.availableLanguages=availableLanguages,_.waiting=!0,_.showM=!1,_.showT=!0,_.data=[],_.currentScope=null,_.currentSession=null,_.menu=o,_.searchString="",_.U2FCheck="1",_.TOTPCheck="1",_.UBKCheck="1",_.translateP=t.translateP,_.translate=t.translate,_.translateTitle=function(e){return t.translateField(e,"title")},f="persistent",_.menuClick=function(e){if(e.popup)window.open(e.popup);else switch(e.action||(e.action=e.title),typeof e.action){case"function":e.action(_.currentNode,_),_[e.action]();break;case"string":_[e.action]();break;default:console.log(typeof e.action)}return _.showM=!1},_.search2FA=function(e){return e&&(_.searchString=""),_.currentSession=null,_.data=[],_.updateTree2("",_.data,0,0)},_.delete2FA=function(e,t){var n,r,a;for(n=0,a=(r=document.querySelectorAll(".data-"+t)).length;n<a;n++)r[n].remove();return _.waiting=!0,i.delete(scriptname+"sfa/"+f+"/"+_.currentSession.id+"?type="+e+"&epoch="+t).then(function(e){return _.waiting=!1},function(e){return _.waiting=!1}),_.showT=!1},_.stoggle=function(e){var t;return 0===(t=e.$modelValue).nodes.length&&_.updateTree(t.value,t.nodes,t.level,t.over,t.query,t.count),e.toggle()},_.displaySession=function(e){var t,n;return n=function(o){var e,t,n,r,a,i,s,u,l,c,h,p,f,d,g,m,T,w,v,y;for(c in e=function(e){return e},function(e,t){var n,r,a,i;for(n in a=[],r=new RegExp(e),o)i=o[n],n.match(r)&&i&&(a.push({title:n,value:i}),delete o[n]);if(0<a.length)return g.push({title:t,nodes:a})},w=o._utime,o)(y=o[c])?("string"==typeof o&&y.match(/; /)&&(o[c]=y.split("; ")),"object"!=typeof o[c]&&("_password".match(new RegExp("\b"+c+"\b"))?o[c]="********":c.match(/^(_utime|_lastAuthnUTime|_lastSeen|notification)$/)?o[c]=_.localeDate(y):c.match(/^(_startTime|_updateTime)$/)&&(d=/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/,n=(y=e(y)).match(d),o[c]=n[3]+"/"+n[2]+"/"+n[1]+" à "+n[4]+":"+n[5]+":"+n[6]))):delete o[c];for(i in g=[],S){for(T=[],u=0,h=(a=S[i]).length;u<h;u++)if(r=a[u],o[r])if(o[r].toString().match(/"type":\s*"(?:TOTP|U2F|UBK)"/)){for(T.push({title:"type",value:"name",epoch:"date"}),l=0,p=(t=JSON.parse(o[r])).length;l<p;l++){for(c in m=t[l])y=m[c],"type"===c&&(v=y),"name"===c&&(f=y),"epoch"===c&&(s=y);T.push({title:v,value:f,epoch:s})}delete o[r]}else o[r].toString().match(/\w+/)&&T.push({title:r,value:o[r]}),delete o[r];else delete o[r];0<T.length&&g.push({title:"__"+i+"__",nodes:T})}return{_utime:w,nodes:g}},_.currentScope=e,t=e.$modelValue.session,i.get(scriptname+"sfa/"+f+"/"+t).then(function(e){return _.currentSession=n(e.data),_.currentSession.id=t}),_.showT=!1},_.localeDate=function(e){return new Date(1e3*e).toLocaleString()},_.getLanguage=function(e){return _.lang=e,_.form="white",_.init(),_.showM=!1},a=function(e,t,n){var r;return(null===(r=t.match(/#!?\/(\w+)/))||r[1].match(/^(persistent)$/))&&(_.type="_session_uid"),_.init()},_.$on("$locationChangeSuccess",a),p=0,_.updateTree=function(o,s,u,l,e,t){var c,h,n;return _.waiting=!0,h=g[_.type]?g[_.type]:g._whatToTrace,c=h[u](_.type,o,e),25<t&&d[_.type]&&(n=d[_.type](_.type,o,u,l,e))?(l++,c=n,u-=1):l=0,i.get(scriptname+"sfa/"+f+"?"+c+"&U2FCheck="+_.U2FCheck+"&TOTPCheck="+_.TOTPCheck+"&UBKCheck="+_.UBKCheck).then(function(e){var t,n,r,a,i;if((t=e.data).result){for(n=0,r=(i=t.values).length;n<r;n++)a=i[n],p++,a.id="node"+p,u<h.length-1&&(a.nodes=[],a.level=u+1,a.query=c,a.over=l),s.push(a);""===o&&(_.total=t.total)}return _.waiting=!1},function(e){return _.waiting=!1})},_.updateTree2=function(o,s,u,l,e,t){var c,h,n;return _.waiting=!0,h=g[_.type]?g[_.type]:"_updateTime"===_.type?g._startTime:g._whatToTrace,c=h[u](_.type,o,e),25<t&&d[_.type]&&(n=d[_.type](_.type,o,u,l,e))?(l++,c=n,u-=1):l=0,i.get(scriptname+"sfa/"+f+"?_session_uid="+_.searchString+"*&groupBy=substr(_session_uid,"+_.searchString.length+")&U2FCheck="+_.U2FCheck+"&TOTPCheck="+_.TOTPCheck+"&UBKCheck="+_.UBKCheck).then(function(e){var t,n,r,a,i;if((t=e.data).result){for(n=0,r=(i=t.values).length;n<r;n++)a=i[n],p++,a.id="node"+p,u<h.length-1&&(a.nodes=[],a.level=u+1,a.query=c,a.over=l),s.push(a);""===o&&(_.total=t.total)}return _.waiting=!1},function(e){return _.waiting=!1})},_.init=function(){return _.waiting=!0,_.data=[],n.all([t.init(_.lang),_.updateTree("",_.data,0,0)]).then(function(){return _.waiting=!1},function(e){return _.waiting=!1}),_.activeModule="2ndFA",_.myStyle={color:"#ffb84d"}},r=e.path().match(/^\/(\w+)/),_.type=r?r[1]:"_whatToTrace"}])}).call(this);