Merge branch 'v2.0'
This commit is contained in:
commit
5804a11099
|
@ -776,6 +776,14 @@ sub tests {
|
|||
return 1;
|
||||
},
|
||||
|
||||
# Notification system required with removed SF notification
|
||||
sfRemovedNotification => sub {
|
||||
return 1 unless ( $conf->{sfRemovedMsgRule} );
|
||||
return ( -1,
|
||||
'Notification system must be enabled to display a notification if a SF is removed'
|
||||
) if ( $conf->{sfRemovedUseNotif} and not $conf->{notification} );
|
||||
return 1;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -827,7 +827,7 @@
|
|||
"sfaTitle":"Second Factors Authentication",
|
||||
"sfExtra":"Additional second factors",
|
||||
"sfRequired":"Require 2FA",
|
||||
"sfRemovedNotification":"Display a message if an expired SF is removed",
|
||||
"sfRemovedNotification":"Warn if an expired SF is removed",
|
||||
"sfRemovedMsgRule":"تفعيل",
|
||||
"sfRemovedUseNotif":"Use Notifications plugin",
|
||||
"sfRemovedNotifMsg":"Notification message",
|
||||
|
|
|
@ -827,7 +827,7 @@
|
|||
"sfaTitle":"Second Factors Authentication",
|
||||
"sfExtra":"Additional second factors",
|
||||
"sfRequired":"Require 2FA",
|
||||
"sfRemovedNotification":"Display a message if an expired SF is removed",
|
||||
"sfRemovedNotification":"Warn if an expired SF is removed",
|
||||
"sfRemovedMsgRule":"Activation",
|
||||
"sfRemovedUseNotif":"Use Notifications plugin",
|
||||
"sfRemovedNotifMsg":"Notification message",
|
||||
|
|
|
@ -827,7 +827,7 @@
|
|||
"sfaTitle":"Second Factors Authentication",
|
||||
"sfExtra":"Additional second factors",
|
||||
"sfRequired":"Require 2FA",
|
||||
"sfRemovedNotification":"Display a message if an expired SF is removed",
|
||||
"sfRemovedNotification":"Warn if an expired SF is removed",
|
||||
"sfRemovedMsgRule":"Activation",
|
||||
"sfRemovedUseNotif":"Use Notifications plugin",
|
||||
"sfRemovedNotifMsg":"Notification message",
|
||||
|
|
|
@ -827,7 +827,7 @@
|
|||
"sfaTitle":"Seconds Facteurs d'Authentification",
|
||||
"sfExtra":"Seconds facteurs additionnels",
|
||||
"sfRequired":"Exiger 2FA",
|
||||
"sfRemovedNotification":"Afficher un message si un SF expiré a été supprimé",
|
||||
"sfRemovedNotification":"Avertir si un SF expiré a été supprimé",
|
||||
"sfRemovedMsgRule":"Activation",
|
||||
"sfRemovedUseNotif":"Utiliser les notifications",
|
||||
"sfRemovedNotifMsg":"Message de la notification",
|
||||
|
|
|
@ -827,7 +827,7 @@
|
|||
"sfaTitle":"Autenticazione a due fattori",
|
||||
"sfExtra":"Additional second factors",
|
||||
"sfRequired":"Richiedi 2FA",
|
||||
"sfRemovedNotification":"Display a message if an expired SF is removed",
|
||||
"sfRemovedNotification":"Warn if an expired SF is removed",
|
||||
"sfRemovedMsgRule":"Attivazione",
|
||||
"sfRemovedUseNotif":"Use Notifications plugin",
|
||||
"sfRemovedNotifMsg":"Notification message",
|
||||
|
|
|
@ -827,7 +827,7 @@
|
|||
"sfaTitle":"İki Faktörlü Kimlik Doğrulaması",
|
||||
"sfExtra":"Ek ikinci faktörler",
|
||||
"sfRequired":"2FA gerektir",
|
||||
"sfRemovedNotification":"Süresi dolan bir SF kaldırıldığında bir mesaj göster",
|
||||
"sfRemovedNotification":"Warn if an expired SF is removed",
|
||||
"sfRemovedMsgRule":"Aktivasyon",
|
||||
"sfRemovedUseNotif":"Bildirimler eklentisini kullan",
|
||||
"sfRemovedNotifMsg":"Bildirim mesajı",
|
||||
|
|
|
@ -827,7 +827,7 @@
|
|||
"sfaTitle":"Second Factors Authentication",
|
||||
"sfExtra":"Additional second factors",
|
||||
"sfRequired":"Require 2FA",
|
||||
"sfRemovedNotification":"Display a message if an expired SF is removed",
|
||||
"sfRemovedNotification":"Warn if an expired SF is removed",
|
||||
"sfRemovedMsgRule":"Kích hoạt",
|
||||
"sfRemovedUseNotif":"Use Notifications plugin",
|
||||
"sfRemovedNotifMsg":"Notification message",
|
||||
|
|
|
@ -827,7 +827,7 @@
|
|||
"sfaTitle":"Second Factors Authentication",
|
||||
"sfExtra":"Additional second factors",
|
||||
"sfRequired":"Require 2FA",
|
||||
"sfRemovedNotification":"Display a message if an expired SF is removed",
|
||||
"sfRemovedNotification":"Warn if an expired SF is removed",
|
||||
"sfRemovedMsgRule":"激活",
|
||||
"sfRemovedUseNotif":"Use Notifications plugin",
|
||||
"sfRemovedNotifMsg":"Notification message",
|
||||
|
|
|
@ -241,9 +241,10 @@ sub run {
|
|||
|
||||
# Display message if required
|
||||
if ( $self->sfMsgRule->( $req, $req->sessionInfo ) ) {
|
||||
my $uid = $req->user;
|
||||
my $date = strftime "%Y-%m-%d", localtime;
|
||||
my $ref = $self->conf->{sfRemovedNotifRef} || 'RemoveSF';
|
||||
my $uid = $req->user;
|
||||
my $date = strftime "%Y-%m-%d", localtime;
|
||||
my $ref = $self->conf->{sfRemovedNotifRef} || 'RemoveSF';
|
||||
$ref .= '-' . time();
|
||||
my $title = $self->conf->{sfRemovedNotifTitle}
|
||||
|| 'Second factor notification';
|
||||
my $msg = $self->conf->{sfRemovedNotifMsg}
|
||||
|
@ -255,8 +256,11 @@ sub run {
|
|||
? { trspan => "expired2Fremoved, $removed" }
|
||||
: { trspan => "oneExpired2Fremoved" };
|
||||
|
||||
my $notifEngine = $self->p->loadedModules->{
|
||||
'Lemonldap::NG::Portal::Plugins::Notifications'};
|
||||
|
||||
my $res =
|
||||
$self->conf->{sfRemovedUseNotif}
|
||||
( $self->conf->{sfRemovedUseNotif} && $notifEngine )
|
||||
? $self->createNotification( $req, $uid, $date, $ref, $title,
|
||||
$msg )
|
||||
: $self->displayTemplate( $req, 'simpleInfo', $params );
|
||||
|
|
|
@ -78,6 +78,7 @@ sub createNotification {
|
|||
my $notifEngine = $self->p->loadedModules->{
|
||||
'Lemonldap::NG::Portal::Plugins::Notifications'};
|
||||
|
||||
$self->logger->debug("Loading Notifications plugin...");
|
||||
return PE_ERROR unless $notifEngine;
|
||||
|
||||
# Prepare notification
|
||||
|
|
|
@ -72,10 +72,10 @@
|
|||
<span trspan="sfaManager">sfaManager</span>
|
||||
</a></li>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF NAME="ContextSwitching">
|
||||
<li class="dropdown-item"><a href="/switchcontext" class="nav-link">
|
||||
<img src="<TMPL_VAR NAME="STATIC_PREFIX">common/icons/switchcontext_<TMPL_VAR NAME="contextSwitching">.png" width="20" height="20" alt="ContentSwitching" />
|
||||
<span trspan="contextSwitching_<TMPL_VAR NAME="contextSwitching">">contextSwitching_<TMPL_VAR NAME="ContextSwitching"></span>
|
||||
<TMPL_IF NAME="Notifications">
|
||||
<li class="dropdown-item"><a href="/mynotifications" class="nav-link">
|
||||
<img src="<TMPL_VAR NAME="STATIC_PREFIX">common/icons/notifsExplorer.png" width="20" height="20" alt="NotificationsExplorer" />
|
||||
<span trspan="notificationsExplorer">notificationsExplorer</span>
|
||||
</a></li>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF NAME="DecryptValue">
|
||||
|
@ -84,10 +84,10 @@
|
|||
<span trspan="decryptCipheredValue">decryptCipheredValue</span>
|
||||
</a></li>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF NAME="Notifications">
|
||||
<li class="dropdown-item"><a href="/mynotifications" class="nav-link">
|
||||
<img src="<TMPL_VAR NAME="STATIC_PREFIX">common/icons/notifsExplorer.png" width="20" height="20" alt="NotificationsExplorer" />
|
||||
<span trspan="notificationsExplorer">notificationsExplorer</span>
|
||||
<TMPL_IF NAME="ContextSwitching">
|
||||
<li class="dropdown-item"><a href="/switchcontext" class="nav-link">
|
||||
<img src="<TMPL_VAR NAME="STATIC_PREFIX">common/icons/switchcontext_<TMPL_VAR NAME="contextSwitching">.png" width="20" height="20" alt="ContentSwitching" />
|
||||
<span trspan="contextSwitching_<TMPL_VAR NAME="contextSwitching">">contextSwitching_<TMPL_VAR NAME="ContextSwitching"></span>
|
||||
</a></li>
|
||||
</TMPL_IF>
|
||||
<li class="dropdown-item"><a href="/refresh" class="nav-link">
|
||||
|
|
|
@ -174,7 +174,7 @@ m%<div class="alert alert-success"><div class="text-center"><b><span trspan="all
|
|||
) or explain( $res->[2]->[0], 'trspan="allowed"' );
|
||||
ok( $res->[2]->[0] =~ m%<td scope="row">Macro_1</td>%, 'Found uid' )
|
||||
or explain( $res->[2]->[0], 'Attribute Value uid' );
|
||||
ok( my $nbr = ( $res->[2]->[0] =~ s%<td scope="row">Macro_1</td>%%g ),
|
||||
ok( $nbr = ( $res->[2]->[0] =~ s%<td scope="row">Macro_1</td>%%g ),
|
||||
'Found two well computed macros' )
|
||||
or explain( $res->[2]->[0], 'Macros not well computed' );
|
||||
ok( $res->[2]->[0] =~ m%<div class="col">authGroup</div>%, 'Found group "authGroup"' )
|
||||
|
|
|
@ -159,7 +159,7 @@ count(4);
|
|||
ok( $code = Lemonldap::NG::Common::TOTP::_code( undef, $keyR, 0, 30, 6 ),
|
||||
'Code' );
|
||||
ok( $code =~ /^\d{6}$/, 'Code contains 6 digits' );
|
||||
my $s = "code=$code&token=$token";
|
||||
$s = "code=$code&token=$token";
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
'/2fregisters/totp/verify',
|
||||
|
|
|
@ -3,8 +3,7 @@ use strict;
|
|||
use IO::String;
|
||||
|
||||
require 't/test-lib.pm';
|
||||
my $maintests = 20;
|
||||
my $file = '20190616_dwho_Tm90aWZpY2F0aW9uX1NG.json';
|
||||
my $maintests = 21;
|
||||
|
||||
SKIP: {
|
||||
eval { require Convert::Base32 };
|
||||
|
@ -21,6 +20,7 @@ SKIP: {
|
|||
totp2fTTL => 120,
|
||||
sfRemovedMsgRule => '$uid eq "dwho"',
|
||||
sfRemovedUseNotif => 1,
|
||||
sfRemovedNotifRef => 'RemoveTOTP',
|
||||
portalMainLogo => 'common/logos/logo_llng_old.png',
|
||||
notification => 1,
|
||||
notificationStorage => 'File',
|
||||
|
@ -146,9 +146,11 @@ SKIP: {
|
|||
expectOK($res);
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
qr%<input type="hidden" name="reference1x1" value="RemoveSF">%,
|
||||
qr%<input type="hidden" name="reference1x1" value="RemoveTOTP-(\d{10})">%,
|
||||
'Notification reference found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok( time() + 300 <= $1 && $1 <= time() + 305, 'Right reference found' )
|
||||
or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
qr%<p class="notifText">1 expired second factor\(s\) has/have been removed!</p>%,
|
||||
|
@ -158,7 +160,7 @@ qr%<p class="notifText">1 expired second factor\(s\) has/have been removed!</p>%
|
|||
$client->logout($id);
|
||||
}
|
||||
count($maintests);
|
||||
system 'rm -f t/*_dwho_UmVtb3ZlU0Y=.json';
|
||||
system 'rm -f t/*_dwho_*.json';
|
||||
clean_sessions();
|
||||
|
||||
done_testing( count() );
|
||||
|
|
|
@ -3,8 +3,7 @@ use strict;
|
|||
use IO::String;
|
||||
|
||||
require 't/test-lib.pm';
|
||||
my $maintests = 20;
|
||||
my $file = '20190616_dwho_Tm90aWZpY2F0aW9uX1NG.json';
|
||||
my $maintests = 21;
|
||||
|
||||
SKIP: {
|
||||
eval {
|
||||
|
@ -25,6 +24,7 @@ SKIP: {
|
|||
totp2fTTL => 120,
|
||||
sfRemovedMsgRule => '$uid eq "dwho"',
|
||||
sfRemovedUseNotif => 1,
|
||||
sfRemovedNotifRef => 'RemoveTOTP',
|
||||
portalMainLogo => 'common/logos/logo_llng_old.png',
|
||||
notification => 1,
|
||||
notificationStorage => 'File',
|
||||
|
@ -150,9 +150,11 @@ SKIP: {
|
|||
expectOK($res);
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
qr%<input type="hidden" name="reference1x1" value="RemoveSF">%,
|
||||
qr%<input type="hidden" name="reference1x1" value="RemoveTOTP-(\d{10})">%,
|
||||
'Notification reference found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok( time() + 300 <= $1 && $1 <= time() + 305, 'Right reference found' )
|
||||
or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
qr%<p class="notifText">1 expired second factor\(s\) has/have been removed!</p>%,
|
||||
|
@ -162,7 +164,7 @@ qr%<p class="notifText">1 expired second factor\(s\) has/have been removed!</p>%
|
|||
$client->logout($id);
|
||||
}
|
||||
count($maintests);
|
||||
system 'rm -f t/*_dwho_UmVtb3ZlU0Y=.xml';
|
||||
system 'rm -f t/*_dwho_*.xml';
|
||||
clean_sessions();
|
||||
|
||||
done_testing( count() );
|
||||
|
|
Loading…
Reference in New Issue