Display removed SF name (#1782)

This commit is contained in:
Christophe Maudoux 2021-06-26 22:30:10 +02:00
parent 71ed63a999
commit 7f91820224
24 changed files with 61 additions and 57 deletions

View File

@ -336,7 +336,7 @@ sub defaultValues {
'sfManagerRule' => 1,
'sfRemovedMsgRule' => 0,
'sfRemovedNotifMsg' =>
'_removedSF_ expired second factor(s) has/have been removed!',
'_removedSF_ expired second factor(s) has/have been removed (_nameSF_)!',
'sfRemovedNotifRef' => 'RemoveSF',
'sfRemovedNotifTitle' => 'Second factor notification',
'sfRequired' => 0,

View File

@ -3949,7 +3949,7 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
},
'sfRemovedNotifMsg' => {
'default' =>
'_removedSF_ expired second factor(s) has/have been removed!',
'_removedSF_ expired second factor(s) has/have been removed (_nameSF_)!',
'type' => 'text'
},
'sfRemovedNotifRef' => {

View File

@ -3226,7 +3226,7 @@ sub attributes {
sfRemovedNotifMsg => {
type => 'text',
default =>
'_removedSF_ expired second factor(s) has/have been removed!',
'_removedSF_ expired second factor(s) has/have been removed (_nameSF_)!',
help => 'secondfactor.html',
documentation => 'Notification message',
},

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_NO_SECOND_FACTORS
);
our $VERSION = '2.0.10';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Plugin';
with 'Lemonldap::NG::Portal::Lib::OverConf';
@ -240,6 +240,7 @@ sub run {
$self->logger->debug("Looking for expired 2F device(s)...");
my $removed = 0;
my $name = '';
my $now = time();
foreach my $device (@$_2fDevices) {
my $type = lc( $device->{type} );
@ -252,16 +253,18 @@ sub run {
);
$self->userLogger->info("Remove expired $device->{type}");
$device->{type} = 'EXPIRED';
$name .= "$device->{name}; ";
$removed++;
}
}
if ($removed) {
$name =~ s/;\s$//;
$self->logger->debug(
"Found $removed EXPIRED 2F device(s) => Update persistent session"
);
$self->userLogger->notice(
" -> $removed expired 2F device(s) removed");
" -> $removed expired 2F device(s) removed ($name)");
@$_2fDevices =
map { $_->{type} =~ /\bEXPIRED\b/ ? () : $_ } @$_2fDevices;
$self->p->updatePersistentSession( $req,
@ -276,13 +279,13 @@ sub run {
my $title = $self->conf->{sfRemovedNotifTitle}
|| 'Second factor notification';
my $msg = $self->conf->{sfRemovedNotifMsg}
|| "$removed expired second factor(s) has/have been removed!";
|| "$removed expired second factor(s) has/have been removed ($name)!";
$msg =~ s/_removedSF_/$removed/;
$msg =~ s/_nameSF_/$name/;
my $params =
$removed > 1
? { trspan => "expired2Fremoved, $removed" }
: { trspan => "oneExpired2Fremoved" };
? { trspan => "expired2Fremoved, $removed, $name" }
: { trspan => "oneExpired2Fremoved, $name" };
my $notifEngine = $self->p->loadedModules->{
'Lemonldap::NG::Portal::Plugins::Notifications'};
@ -384,8 +387,8 @@ sub run {
# bool public display2fRegisters($req, $session)
#
# Return true if at least 1 register module is available for this user. Used
# by Menu to display or not /2fregisters page
# Return true if at least 1 register module is available for this user.
# Used by Menu for displaying or not /2fregisters page
sub display2fRegisters {
my ( $self, $req, $session ) = @_;
foreach my $m ( @{ $self->sfRModules } ) {

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Enter TOTP code",
"enterYubikey":"يرجى استخدام يوبي كي الخاص بك",
"errorMsg":"رسالة خاطئة",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"الاسم الاول",
@ -225,7 +225,7 @@
"oidcConsent":"التطبيق ٪s هل ترغب في معرفة:",
"oidcConsents":"OIDC consents",
"oidcConsentsFull":"OpenID Connect consents",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"فمثلا:http://myopenid.org/toto",
"openSSOSession":"افتح جلسة الدخول الموحد (سسو)",
"openSessionSpace":"هذه المساحة تتيح لك فتح جلسة تسجيل الدخول الموحد (سسو).سوف تساعدك على الوصول بشكل آمن إلى جميع التطبيقات التي أذن بها بروفيل الخاص بك.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Gebe den TOTP Code ein",
"enterYubikey":"Benutze bitte deinen Yubikey",
"errorMsg":"Fehlermeldung",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"Vorname",
@ -225,7 +225,7 @@
"oidcConsent":"The application %s would like to:",
"oidcConsents":"OIDC consents",
"oidcConsentsFull":"OpenID Connect consents",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"zum Beispiel: http://myopenid.org/toto",
"openSSOSession":"Eine SSO Sitzung öffnen",
"openSessionSpace":"Mit diesem Bereich kannst du eine SSO-Sitzung öffnen. Dadurch kannst du sicher auf alle von deinem Profil autorisierten Anwendungen zugreifen.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Enter TOTP code",
"enterYubikey":"Please use your Yubikey",
"errorMsg":"Error Message",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"First name",
@ -225,7 +225,7 @@
"oidcConsent":"The application %s would like to:",
"oidcConsents":"OIDC consents",
"oidcConsentsFull":"OpenID Connect consents",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"for example:http://myopenid.org/toto",
"openSSOSession":"Open your SSO session",
"openSessionSpace":"This space allow you to open a SSO session. This will help you to securely access to all applications authorized by your profile.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Ingrese el código TOTP",
"enterYubikey":"Por favor utilice su Yubikey",
"errorMsg":"Mensaje de Error",
"expired2Fremoved":"¡%s dispositivos 2F caducados han sido suprimidos!",
"expired2Fremoved":"¡%s dispositivos 2F caducados han sido suprimidos (%s)!",
"explorer":"Explorer",
"ext2f":"Código de verificación",
"firstName":"Nombre",
@ -225,7 +225,7 @@
"oidcConsent":"La aplicación %s quisiera:",
"oidcConsents":"Permisos OIDC",
"oidcConsentsFull":"Permisos OpenID Connect",
"oneExpired2Fremoved":"¡Un dispositivo 2F caducado ha sido suprimido!",
"oneExpired2Fremoved":"¡Un dispositivo 2F caducado ha sido suprimido (%s)!",
"openIdExample":"por ejemplo:http://myopenid.org/juan",
"openSSOSession":"Abra su sesión SSO",
"openSessionSpace":"Este espacio le permite abrir una sesión SSO. Esto le ayudará a acceder de manera segura a todas las aplicaciones autorizadas por su perfil.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Enter TOTP code",
"enterYubikey":"Please use your Yubikey",
"errorMsg":"Virhe viesti",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"Etunimi",
@ -225,7 +225,7 @@
"oidcConsent":"The application %s would like to:",
"oidcConsents":"OIDC consents",
"oidcConsentsFull":"OpenID Connect consents",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"for example:http://myopenid.org/toto",
"openSSOSession":"Open your SSO session",
"openSessionSpace":"This space allow you to open a SSO session. This will help you to securely access to all applications authorized by your profile.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Entrez le code TOTP",
"enterYubikey":"Utilisez votre Yubikey",
"errorMsg":"Message d'erreur",
"expired2Fremoved":"%s seconds facteurs expirés ont été supprimés !",
"expired2Fremoved":"%s seconds facteurs expirés ont été supprimés (%s) !",
"explorer":"Explorateur",
"ext2f":"Code de vérification",
"firstName":"Prénom",
@ -225,7 +225,7 @@
"oidcConsent":"L'application %s voudrait :",
"oidcConsents":"Accords OIDC",
"oidcConsentsFull":"Accords OpenID Connect",
"oneExpired2Fremoved":"Un second facteur expiré a été supprimé !",
"oneExpired2Fremoved":"Un second facteur expiré a été supprimé (%s) !",
"openIdExample":"par exemple : http://myopenid.org/toto",
"openSSOSession":"Ouvrir une session SSO",
"openSessionSpace":"Cet espace vous permet d'ouvrir une session SSO. Celle-ci vous aidera à accéder de manière totalement sécurisée à l'ensemble des applications autorisées par votre profil utilisateur.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Inserisci il codice TOTP",
"enterYubikey":"Utilizza il tuo Yubikey",
"errorMsg":"Messaggio di errore",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"Nome",
@ -225,7 +225,7 @@
"oidcConsent":"L'applicazione %s vorrebbe sapere:",
"oidcConsents":"Consensi OIDC",
"oidcConsentsFull":"Consensi OpenID Connect",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"per esempio:http://myopenid.org/toto",
"openSSOSession":"Apri la sessione SSO",
"openSessionSpace":"Questo spazio consente di aprire una sessione SSO. Questo vi aiuterà ad accedere in modo sicuro a tutte le applicazioni autorizzate dal tuo profilo.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Enter TOTP code",
"enterYubikey":"Please use your Yubikey",
"errorMsg":"Error Message",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"First name",
@ -225,7 +225,7 @@
"oidcConsent":"The application %s would like to:",
"oidcConsents":"OIDC consents",
"oidcConsentsFull":"OpenID Connect consents",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"for example:http://myopenid.org/toto",
"openSSOSession":"Open your SSO session",
"openSessionSpace":"This space allow you to open a SSO session. This will help you to securely access to all applications authorized by your profile.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Wpisz kod TOTP",
"enterYubikey":"Proszę użyć klucza Yubikey",
"errorMsg":"Komunikat o błędzie",
"expired2Fremoved":"%s przeterminowane urządzenia 2F zostały usunięte!",
"expired2Fremoved":"%s przeterminowane urządzenia 2F zostały usunięte (%s)!",
"explorer":"Eksplorator",
"ext2f":"Kod weryfikacyjny",
"firstName":"Imię",
@ -225,7 +225,7 @@
"oidcConsent":"Aplikacja %s chciałaby znać:",
"oidcConsents":"OIDC wyraża zgodę",
"oidcConsentsFull":"Zgody OpenID-Connect",
"oneExpired2Fremoved":"Przeterminowane urządzenie 2F zostało usunięte!",
"oneExpired2Fremoved":"Przeterminowane urządzenie 2F zostało usunięte (%s)!",
"openIdExample":"na przykład: http://myopenid.org/toto",
"openSSOSession":"Otwórz sesję logowania jednokrotnego",
"openSessionSpace":"Ta przestrzeń umożliwia otwarcie sesji SSO. Pomoże to w bezpiecznym dostępie do wszystkich aplikacji autoryzowanych przez Twój profil.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Enter TOTP code",
"enterYubikey":"Please use your Yubikey",
"errorMsg":"Error Message",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"First name",
@ -225,7 +225,7 @@
"oidcConsent":"The application %s would like to:",
"oidcConsents":"OIDC consents",
"oidcConsentsFull":"OpenID Connect consents",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"for example:http://myopenid.org/toto",
"openSSOSession":"Open your SSO session",
"openSessionSpace":"This space allow you to open a SSO session. This will help you to securely access to all applications authorized by your profile.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Enter TOTP code",
"enterYubikey":"Please use your Yubikey",
"errorMsg":"Error Message",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"First name",
@ -225,7 +225,7 @@
"oidcConsent":"The application %s would like to:",
"oidcConsents":"OIDC consents",
"oidcConsentsFull":"OpenID Connect consents",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"for example:http://myopenid.org/toto",
"openSSOSession":"Open your SSO session",
"openSessionSpace":"This space allow you to open a SSO session. This will help you to securely access to all applications authorized by your profile.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"TOTP kodunu gir",
"enterYubikey":"Lütfen Yubikey'inizi kullanın",
"errorMsg":"Hata Mesajı",
"expired2Fremoved":"Kullanım süresi dolan %s2F cihazı kaldırıldı!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Doğrulama kodu",
"firstName":"Ad",
@ -225,7 +225,7 @@
"oidcConsent":"%s uygulaması şunları yapmak istiyor:",
"oidcConsents":"OIDC izinleri",
"oidcConsentsFull":"OpenID Connect izinleri",
"oneExpired2Fremoved":"Kullanım süresi dolan bir 2F cihazı kaldırıldı!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"örneğin: http://myopenid.org/toto",
"openSSOSession":"TOA oturumunuzu açın",
"openSessionSpace":"Bu alan bir TOA oturumu açmanıza izin verir. Oturum açtığınızda profiliniz için yetkilendirilmiş tüm uygulamalara güvenli bir şekilde erişebilirsiniz.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Enter TOTP code",
"enterYubikey":"Vui lòng sử dụng Yubikey của bạn",
"errorMsg":"Thông báo lỗi",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"Tên",
@ -225,7 +225,7 @@
"oidcConsent":"Ứng dụng %s muốn biết:",
"oidcConsents":"OIDC consents",
"oidcConsentsFull":"OpenID Connect consents",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"ví dụ: http: //myopenid.org/toto",
"openSSOSession":"Mở phiên SSO của bạn",
"openSessionSpace":"Không gian này cho phép bạn mở phiên SSO. Điều này sẽ giúp bạn truy cập an toàn vào tất cả các ứng dụng được cho phép bởi profile của bạn. ",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"Enter TOTP code",
"enterYubikey":"请使用您的Yubikey",
"errorMsg":"错误消息",
"expired2Fremoved":"%s expired 2F devices have been removed!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"Explorer",
"ext2f":"Verification code",
"firstName":"名",
@ -225,7 +225,7 @@
"oidcConsent":"The application %s would like to:",
"oidcConsents":"OIDC consents",
"oidcConsentsFull":"OpenID Connect consents",
"oneExpired2Fremoved":"An expired 2F device has been removed!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"例如http://myopenid.org/toto",
"openSSOSession":"Open your SSO session",
"openSessionSpace":"This space allow you to open a SSO session. This will help you to securely access to all applications authorized by your profile.",

View File

@ -165,7 +165,7 @@
"enterTotpCode":"輸入 TOTP 代碼",
"enterYubikey":"請使用您的 Yubikey",
"errorMsg":"錯誤訊息",
"expired2Fremoved":"%s 個過期的雙因素驗證已被移除!",
"expired2Fremoved":"%s expired 2F devices have been removed (%s)!",
"explorer":"探索者",
"ext2f":"驗證代碼",
"firstName":"名",
@ -225,7 +225,7 @@
"oidcConsent":"應用程式 %s 想要:",
"oidcConsents":"OIDC 同意",
"oidcConsentsFull":"OpenID 連線同意",
"oneExpired2Fremoved":"過期的雙因素驗證裝置已被移除!",
"oneExpired2Fremoved":"An expired 2F device has been removed (%s)!",
"openIdExample":"例如http://myopenid.org/toto",
"openSSOSession":"開啟您的 SSO 工作階段",
"openSessionSpace":"此空間讓您可以開啟 SSO 工作階段。這將協助您安全地存取您個人檔案授權的所有應用程式。",

View File

@ -263,7 +263,7 @@ qr%<input type="hidden" name="reference1x1" value="RemoveSF-(\d{10})"/>%,
or print STDERR Dumper( $res->[2]->[0] ), time(), " / $1";
ok(
$res->[2]->[0] =~
qr%<p class="notifText">1 expired second factor\(s\) has/have been removed!</p>%,
qr%<p class="notifText">1 expired second factor\(s\) has/have been removed \(\d{10}\)!</p>%,
'Notification message found'
) or print STDERR Dumper( $res->[2]->[0] );
$id = expectCookie($res);
@ -298,7 +298,7 @@ qr%<input type="hidden" name="reference1x2" value="RemoveSF-(\d{10})"/>%,
or print STDERR Dumper( $res->[2]->[0] ), time(), " / $1";
my @notifs =
( $res->[2]->[0] =~
m%<p class="notifText">1 expired second factor\(s\) has/have been removed!</p>%gs
m%<p class="notifText">1 expired second factor\(s\) has/have been removed \((?:myTOTP|\d{10})\)!</p>%gs
);
ok( 2 == @notifs, '2 notifications found' )
or print STDERR Dumper( $res->[2]->[0] );

View File

@ -14,16 +14,17 @@ SKIP: {
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
totp2fSelfRegistration => 1,
totp2fActivation => 1,
totp2fTTL => 120,
sfRemovedMsgRule => '$uid eq "dwho"',
sfRemovedUseNotif => 1,
sfRemovedNotifRef => 'Remov_e_TOTP',
portalMainLogo => 'common/logos/logo_llng_old.png',
notification => 1,
notificationStorage => 'File',
logLevel => 'error',
totp2fSelfRegistration => 1,
totp2fActivation => 1,
totp2fTTL => 120,
sfRemovedMsgRule => '$uid eq "dwho"',
sfRemovedUseNotif => 1,
sfRemovedNotifRef => 'Remov_e_TOTP',
sfRemovedNotifMsg => '_removedSF_ SF removed = _nameSF_',
portalMainLogo => 'common/logos/logo_llng_old.png',
notification => 1,
notificationStorage => 'File',
notificationStorageOptions => { dirName => $main::tmpDir },
oldNotifFormat => 0,
}
@ -153,7 +154,7 @@ qr%<input type="hidden" name="reference1x1" value="Remov-e-TOTP-(\d{10})"/>%,
or print STDERR Dumper( $res->[2]->[0] ), time(), " / $1";
ok(
$res->[2]->[0] =~
qr%<p class="notifText">1 expired second factor\(s\) has/have been removed!</p>%,
qr%<p class="notifText">1 SF removed = myTOTP</p>%,
'Notification message found'
) or print STDERR Dumper( $res->[2]->[0] );
$id = expectCookie($res);

View File

@ -157,7 +157,7 @@ qr%<input type="hidden" name="reference1x1" value="Remove-TOTP-(\d{10})">%,
or print STDERR Dumper( $res->[2]->[0] ), time(), " / $1";
ok(
$res->[2]->[0] =~
qr%<p class="notifText">1 expired second factor\(s\) has/have been removed!</p>%,
qr%<p class="notifText">1 expired second factor\(s\) has/have been removed \(myTOTP\)!</p>%,
'Notification message found'
) or print STDERR Dumper( $res->[2]->[0] );
$id = expectCookie($res);

View File

@ -218,7 +218,7 @@ JjTJecOOS+88fK8qL1TrYv5rapIdqUI7aQ==
expectOK($res);
ok(
$res->[2]->[0] =~
qr%<h3 trspan="oneExpired2Fremoved">oneExpired2Fremoved</h3>%,
qr%<h3 trspan="oneExpired2Fremoved, \d{10}">oneExpired2Fremoved, \d{10}</h3>%,
'Found expired 2F message'
) or print STDERR Dumper( $res->[2]->[0] );
my $c = getCookies($res);