diff --git a/lemonldap-ng-portal/site/htdocs/static/common/js/totpregistration.min.js b/lemonldap-ng-portal/site/htdocs/static/common/js/totpregistration.min.js index 1a07b6a63..c097b3b79 100644 --- a/lemonldap-ng-portal/site/htdocs/static/common/js/totpregistration.min.js +++ b/lemonldap-ng-portal/site/htdocs/static/common/js/totpregistration.min.js @@ -1 +1 @@ -!function(){var o=function(e,r){return $("#msg").attr("trspan",e),$("#msg").html(window.translate(e)),$("#color").removeClass("message-positive message-warning message-danger alert-success alert-warning alert-danger"),$("#color").addClass("message-"+r),"positive"===r&&(r="success"),$("#color").addClass("alert-"+r)},r=function(e,r,t){if(console.log("Error",t),(e=JSON.parse(e.responseText))&&e.error)return e=e.error.replace(/.* /,""),console.log("Returned error",e),o(e,"warning")},t="",e=function(){return o("yourTotpKey","warning"),$.ajax({type:"POST",url:portal+"/2fregisters/totp/getkey",dataType:"json",error:r,success:function(e){var r;return e.error?(e.error.match(/totpExistingKey/)&&$("#divToHide").hide(),o(e.error,"warning")):e.portal&&e.user&&e.secret?($("#divToHide").show(),r="otpauth://totp/"+escape(e.portal)+":"+escape(e.user)+"?secret="+e.secret+"&issuer="+escape(e.portal),6!==e.digits&&(r+="&digits="+e.digits),30!==e.interval&&(r+="&period="+e.interval),new QRious({element:document.getElementById("qr"),value:r,size:150}),r=e.secret||"",$("#secret").text(r.toUpperCase().replace(/(.{4})/g,"$1 ").trim()),e.newkey?o("yourNewTotpKey","warning"):o("yourTotpKey","success"),t=e.token):o("PE24","danger")}})},s=function(){var e=$("#code").val();return e?$.ajax({type:"POST",url:portal+"/2fregisters/totp/verify",dataType:"json",data:{token:t,code:e,TOTPName:$("#TOTPName").val()},error:r,success:function(e){return e.error?e.error.match(/bad(Code|Name)/)?o(e.error,"warning"):o(e.error,"danger"):o("yourKeyIsRegistered","success")}}):(o("totpMissingCode","warning"),$("#code").focus())};$(document).ready(function(){return e(),$("#verify").on("click",s)})}.call(this); \ No newline at end of file +(function(){var r,e,s,o,t;s=function(e,r){return $("#msg").attr("trspan",e),$("#msg").html(window.translate(e)),$("#color").removeClass("message-positive message-warning message-danger alert-success alert-warning alert-danger"),$("#color").addClass("message-"+r),"positive"===r&&(r="success"),$("#color").addClass("alert-"+r)},r=function(e,r,t){var o;if(console.log("Error",t),(o=JSON.parse(e.responseText))&&o.error)return o=o.error.replace(/.* /,""),console.log("Returned error",o),s(o,"warning")},o="",e=function(){return s("yourTotpKey","warning"),$.ajax({type:"POST",url:portal+"/2fregisters/totp/getkey",dataType:"json",error:r,success:function(e){var r,t;return e.error?(e.error.match(/totpExistingKey/)&&$("#divToHide").hide(),s(e.error,"warning")):e.portal&&e.user&&e.secret?($("#divToHide").show(),r="otpauth://totp/"+escape(e.portal)+":"+escape(e.user)+"?secret="+e.secret+"&issuer="+escape(e.portal),6!==e.digits&&(r+="&digits="+e.digits),30!==e.interval&&(r+="&period="+e.interval),new QRious({element:document.getElementById("qr"),value:r,size:150}),t=e.secret||"",$("#secret").text(t.toUpperCase().replace(/(.{4})/g,"$1 ").trim()),e.newkey?s("yourNewTotpKey","warning"):s("yourTotpKey","success"),o=e.token):s("PE24","danger")}})},t=function(){var e;return(e=$("#code").val())?$.ajax({type:"POST",url:portal+"/2fregisters/totp/verify",dataType:"json",data:{token:o,code:e,TOTPName:$("#TOTPName").val()},error:r,success:function(e){return e.error?e.error.match(/bad(Code|Name)/)?s(e.error,"warning"):s(e.error,"danger"):s("yourKeyIsRegistered","success")}}):(s("totpMissingCode","warning"),$("#code").focus())},$(document).ready(function(){return e(),$("#verify").on("click",function(){return t()})})}).call(this); \ No newline at end of file diff --git a/lemonldap-ng-portal/site/htdocs/static/common/js/totpregistration.min.js.map b/lemonldap-ng-portal/site/htdocs/static/common/js/totpregistration.min.js.map index 2d893f150..a377a6b35 100644 --- a/lemonldap-ng-portal/site/htdocs/static/common/js/totpregistration.min.js.map +++ b/lemonldap-ng-portal/site/htdocs/static/common/js/totpregistration.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["totpregistration.js"],"names":["setMsg","msg","level","$","attr","html","window","translate","removeClass","addClass","displayError","j","status","err","console","log","res","JSON","parse","responseText","error","replace","token","getKey","ajax","type","url","portal","dataType","success","data","secret","match","hide","user","show","s","escape","digits","interval","QRious","element","document","getElementById","value","size","text","toUpperCase","trim","newkey","verify","val","code","TOTPName","focus","ready","on","call","this"],"mappings":"CAMA,WACE,IAEAA,EAAS,SAASC,EAAKC,GAQrB,OAPAC,EAAE,QAAQC,KAAK,SAAUH,GACzBE,EAAE,QAAQE,KAAKC,OAAOC,UAAUN,IAChCE,EAAE,UAAUK,YAAY,4FACxBL,EAAE,UAAUM,SAAS,WAAaP,GACpB,aAAVA,IACFA,EAAQ,WAEHC,EAAE,UAAUM,SAAS,SAAWP,IAGzCQ,EAAe,SAASC,EAAGC,EAAQC,GAIjC,GAFAC,QAAQC,IAAI,QAASF,IACrBG,EAAMC,KAAKC,MAAMP,EAAEQ,gBACRH,EAAII,MAGb,OAFAJ,EAAMA,EAAII,MAAMC,QAAQ,MAAO,IAC/BP,QAAQC,IAAI,iBAAkBC,GACvBhB,EAAOgB,EAAK,YAIvBM,EAAQ,GAERC,EAAS,WAEP,OADAvB,EAAO,cAAe,WACfG,EAAEqB,KAAK,CACZC,KAAM,OACNC,IAAKC,OAAS,2BACdC,SAAU,OACVR,MAAOV,EACPmB,QAAS,SAASC,GAChB,IAAWC,EACX,OAAID,EAAKV,OACHU,EAAKV,MAAMY,MAAM,oBACnB7B,EAAE,cAAc8B,OAEXjC,EAAO8B,EAAKV,MAAO,YAEtBU,EAAKH,QAAUG,EAAKI,MAAQJ,EAAKC,QAGvC5B,EAAE,cAAcgC,OAChBC,EAAI,kBAAqBC,OAAOP,EAAKH,QAAW,IAAOU,OAAOP,EAAKI,MAAS,WAAaJ,EAAKC,OAAS,WAAcM,OAAOP,EAAKH,QAC7G,IAAhBG,EAAKQ,SACPF,GAAK,WAAaN,EAAKQ,QAEH,KAAlBR,EAAKS,WACPH,GAAK,WAAaN,EAAKS,UAEpB,IAAIC,OAAO,CACdC,QAASC,SAASC,eAAe,MACjCC,MAAOR,EACPS,KAAM,MAERd,EAASD,EAAKC,QAAU,GACxB5B,EAAE,WAAW2C,KAAKf,EAAOgB,cAAc1B,QAAQ,UAAW,OAAO2B,QAC7DlB,EAAKmB,OACPjD,EAAO,iBAAkB,WAEzBA,EAAO,cAAe,WAEjBsB,EAAQQ,EAAKR,OAtBXtB,EAAO,OAAQ,cA2B9BkD,EAAS,WACP,IACAC,EAAMhD,EAAE,SAASgD,MACjB,OAAKA,EAIIhD,EAAEqB,KAAK,CACZC,KAAM,OACNC,IAAKC,OAAS,2BACdC,SAAU,OACVE,KAAM,CACJR,MAAOA,EACP8B,KAAMD,EACNE,SAAUlD,EAAE,aAAagD,OAE3B/B,MAAOV,EACPmB,QAAS,SAASC,GAChB,OAAIA,EAAKV,MACHU,EAAKV,MAAMY,MAAM,kBACZhC,EAAO8B,EAAKV,MAAO,WAEnBpB,EAAO8B,EAAKV,MAAO,UAGrBpB,EAAO,sBAAuB,eArB3CA,EAAO,kBAAmB,WACnBG,EAAE,SAASmD,UA2BtBnD,EAAEuC,UAAUa,MAAM,WAEhB,OADAhC,IACOpB,EAAE,WAAWqD,GAAG,QACdN,MAIVO,KAAKC"} \ No newline at end of file +{"version":3,"sources":["totpregistration.js"],"names":["displayError","getKey","setMsg","token","verify","msg","level","$","attr","html","window","translate","removeClass","addClass","j","status","err","res","console","log","JSON","parse","responseText","error","replace","ajax","type","url","portal","dataType","success","data","s","secret","match","hide","user","show","escape","digits","interval","QRious","element","document","getElementById","value","size","text","toUpperCase","trim","newkey","val","code","TOTPName","focus","ready","on","call","this"],"mappings":"CAMA,WACE,IAAIA,EAAcC,EAAQC,EAAQC,EAAOC,EAEzCF,EAAS,SAASG,EAAKC,GAQrB,OAPAC,EAAE,QAAQC,KAAK,SAAUH,GACzBE,EAAE,QAAQE,KAAKC,OAAOC,UAAUN,IAChCE,EAAE,UAAUK,YAAY,4FACxBL,EAAE,UAA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AAM,OACNC,IAAKC,OAAS,2BACdC,SAAU,OACVE,KAAM,CACJ5B,MAAOA,EACPiD,KAAMD,EACNE,SAAU9C,EAAE,aAAa4C,OAE3B5B,MAAOvB,EACP8B,QAAS,SAASC,GAChB,OAAIA,EAAKR,MACHQ,EAAKR,MAAMW,MAAM,kBACZhC,EAAO6B,EAAKR,MAAO,WAEnBrB,EAAO6B,EAAKR,MAAO,UAGrBrB,EAAO,sBAAuB,eArB3CA,EAAO,kBAAmB,WACnBK,EAAE,SAAS+C,UA2BtB/C,EAAEoC,UAAUY,MAAM,WAEhB,OADAtD,IACOM,EAAE,WAAWiD,GAAG,QAAS,WAC9B,OAAOpD,UAIVqD,KAAKC"} \ No newline at end of file diff --git a/lemonldap-ng-portal/t/64-StayConnected-with-2F-and-History.t b/lemonldap-ng-portal/t/64-StayConnected-with-2F-and-History.t index 7be28c4a3..23b63b3eb 100644 --- a/lemonldap-ng-portal/t/64-StayConnected-with-2F-and-History.t +++ b/lemonldap-ng-portal/t/64-StayConnected-with-2F-and-History.t @@ -363,8 +363,8 @@ JjTJecOOS+88fK8qL1TrYv5rapIdqUI7aQ== # History is displayed ok( $res->[2]->[0] =~ qr%[2]->[0] ); + 'Found custom main Logo' + ) or explain( $res->[2]->[0], 'Custom main logo' ); ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' ) or explain( $res->[2]->[0], 'trspan="lastLogins"' ); @c = ( $res->[2]->[0] =~ /127.0.0.1/gs ); @@ -385,7 +385,7 @@ JjTJecOOS+88fK8qL1TrYv5rapIdqUI7aQ== ); ok( $res->[2]->[0] =~ m%Your applications%, ' Apps menu found' ) - or print STDERR Dumper( $res->[2]->[0] ); + or explain( $res->[2]->[0], 'Apps menu' ); $client->logout($id); diff --git a/lemonldap-ng-portal/t/64-StayConnected-with-History.t b/lemonldap-ng-portal/t/64-StayConnected-with-History.t index c2cd8b562..0327b6552 100644 --- a/lemonldap-ng-portal/t/64-StayConnected-with-History.t +++ b/lemonldap-ng-portal/t/64-StayConnected-with-History.t @@ -82,8 +82,8 @@ ok( ); expectRedirection( $res, 'http://auth.example.com/' ); my $cid = expectCookie( $res, 'llngpersistent' ); -ok( $res->[1]->[5] =~ /\bsecure\b/, ' Secured cookie found' ) - or print STDERR Dumper( $res->[1]->[5] ); +ok( $res->[1]->[5] =~ /\bsecure\b/, ' Secure cookie found' ) + or explain($res->[1]->[5], 'Secure cookie found' ); count(2); $client->logout($id); @@ -178,8 +178,8 @@ ok( $query =~ /user/, ' Get login form' ); expectCookie( $res, 'llngpersistent' ); my @connexionCookie = grep /llngpersistent/, @{ $res->[1] }; ok( $connexionCookie[0] =~ /secure/ && $connexionCookie[0] =~ /21 Oct 2015/, - 'Found secured and expired connexion Cookie' ) - or print STDERR Dumper( $connexionCookie[0] ); + 'Found secure and expired connexion Cookie' ) + or explain( $connexionCookie[0], 'Secure and expired cookie' ); count(3); # Try to authenticate with history @@ -214,8 +214,8 @@ count(1); $cid = expectCookie( $res, 'llngpersistent' ); ok( $res->[2]->[0] =~ qr%[2]->[0] ); + 'Found custom main Logo' ) + or explain( $res->[2]->[0], 'Custom main logo' ); ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' ) or explain( $res->[2]->[0], 'trspan="lastLogins"' ); my @c = ( $res->[2]->[0] =~ /127.0.0.1/gs ); @@ -236,7 +236,7 @@ ok( ); ok( $res->[2]->[0] =~ m%Your applications%, ' Apps menu found' ) - or print STDERR Dumper( $res->[2]->[0] ); + or explain( $res->[2]->[0], 'Apps menu' ); count(6); expectOK($res); diff --git a/lemonldap-ng-portal/t/67-CheckUser-with-Global-token.t b/lemonldap-ng-portal/t/67-CheckUser-with-Global-token.t index 13b82edd9..06dbadf78 100644 --- a/lemonldap-ng-portal/t/67-CheckUser-with-Global-token.t +++ b/lemonldap-ng-portal/t/67-CheckUser-with-Global-token.t @@ -2,9 +2,8 @@ use Test::More; use strict; use IO::String; -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; + my $res; diff --git a/lemonldap-ng-portal/t/67-CheckUser-with-Impersonation-and-Macros.t b/lemonldap-ng-portal/t/67-CheckUser-with-Impersonation-and-Macros.t index bd9e35d30..0d09ca41f 100644 --- a/lemonldap-ng-portal/t/67-CheckUser-with-Impersonation-and-Macros.t +++ b/lemonldap-ng-portal/t/67-CheckUser-with-Impersonation-and-Macros.t @@ -2,9 +2,8 @@ use Test::More; use strict; use IO::String; -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; + my $res; diff --git a/lemonldap-ng-portal/t/67-CheckUser-with-UnrestrictedUser.t b/lemonldap-ng-portal/t/67-CheckUser-with-UnrestrictedUser.t index 6ca20413b..91bc8da36 100644 --- a/lemonldap-ng-portal/t/67-CheckUser-with-UnrestrictedUser.t +++ b/lemonldap-ng-portal/t/67-CheckUser-with-UnrestrictedUser.t @@ -3,9 +3,7 @@ use strict; use IO::String; use JSON qw(to_json from_json); -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; my $res; diff --git a/lemonldap-ng-portal/t/67-CheckUser-with-history.t b/lemonldap-ng-portal/t/67-CheckUser-with-history.t index 868f72e31..511123c03 100644 --- a/lemonldap-ng-portal/t/67-CheckUser-with-history.t +++ b/lemonldap-ng-portal/t/67-CheckUser-with-history.t @@ -2,9 +2,7 @@ use Test::More; use strict; use IO::String; -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; my $res; my $client = LLNG::Manager::Test->new( { diff --git a/lemonldap-ng-portal/t/67-CheckUser-with-rules.t b/lemonldap-ng-portal/t/67-CheckUser-with-rules.t index 428b35bc6..a73043953 100644 --- a/lemonldap-ng-portal/t/67-CheckUser-with-rules.t +++ b/lemonldap-ng-portal/t/67-CheckUser-with-rules.t @@ -3,14 +3,13 @@ use IO::String; use strict; use JSON qw(to_json from_json); -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; + my $res; my $client = LLNG::Manager::Test->new( { ini => { - logLevel => 'debug', + logLevel => 'error', authentication => 'Demo', userDB => 'Same', loginHistoryEnabled => 1, diff --git a/lemonldap-ng-portal/t/67-CheckUser-with-token.t b/lemonldap-ng-portal/t/67-CheckUser-with-token.t index 9be3fb44b..9fdea7c23 100644 --- a/lemonldap-ng-portal/t/67-CheckUser-with-token.t +++ b/lemonldap-ng-portal/t/67-CheckUser-with-token.t @@ -2,9 +2,8 @@ use Test::More; use strict; use IO::String; -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; + my $res; diff --git a/lemonldap-ng-portal/t/67-CheckUser.t b/lemonldap-ng-portal/t/67-CheckUser.t index 076685547..3fdd1ab43 100644 --- a/lemonldap-ng-portal/t/67-CheckUser.t +++ b/lemonldap-ng-portal/t/67-CheckUser.t @@ -3,9 +3,7 @@ use strict; use IO::String; use JSON; -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; my $res; diff --git a/lemonldap-ng-portal/t/68-ContextSwitching-with-2F.t b/lemonldap-ng-portal/t/68-ContextSwitching-with-2F.t index 3f7e2736f..29994a33e 100644 --- a/lemonldap-ng-portal/t/68-ContextSwitching-with-2F.t +++ b/lemonldap-ng-portal/t/68-ContextSwitching-with-2F.t @@ -3,9 +3,8 @@ use strict; use IO::String; use JSON qw(to_json from_json); -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; + my $maintests = 76; SKIP: { diff --git a/lemonldap-ng-portal/t/68-ContextSwitching-with-Logout.t b/lemonldap-ng-portal/t/68-ContextSwitching-with-Logout.t index 122f5c045..c7ea22243 100644 --- a/lemonldap-ng-portal/t/68-ContextSwitching-with-Logout.t +++ b/lemonldap-ng-portal/t/68-ContextSwitching-with-Logout.t @@ -3,9 +3,7 @@ use strict; use IO::String; use JSON; -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; my $res; diff --git a/lemonldap-ng-portal/t/68-ContextSwitching-with-UnrestrictedUser.t b/lemonldap-ng-portal/t/68-ContextSwitching-with-UnrestrictedUser.t index be219ed01..af3ed8de3 100644 --- a/lemonldap-ng-portal/t/68-ContextSwitching-with-UnrestrictedUser.t +++ b/lemonldap-ng-portal/t/68-ContextSwitching-with-UnrestrictedUser.t @@ -3,9 +3,7 @@ use strict; use IO::String; use JSON qw(to_json from_json); -BEGIN { - require 't/test-lib.pm'; -} +require 't/test-lib.pm'; my $res;