* [LEMONLDAP-412] Make a pretty print for password expiration warning time
This commit is contained in:
parent
17d0f0a557
commit
c7d7369215
|
@ -1462,24 +1462,27 @@ sub stamp {
|
|||
# @return a formated time
|
||||
sub convertSec {
|
||||
my ( $self, $sec ) = splice @_;
|
||||
|
||||
# If we only have seconds
|
||||
return "00:00:$sec" if ( $sec < 60 );
|
||||
my ( $day, $hrs, $min ) = (0, 0, 0);
|
||||
|
||||
# Calculate the minutes
|
||||
my $min = $sec / 60, $sec %= 60;
|
||||
if ( $sec > 60 ) {
|
||||
$min = $sec / 60, $sec %= 60;
|
||||
$min = int($min);
|
||||
return "00:$min:$sec" if ( $min < 60 );
|
||||
}
|
||||
|
||||
# Calculate the hours
|
||||
my $hrs = $min / 60, $min %= 60;
|
||||
if ( $min > 60 ) {
|
||||
$hrs = $min / 60, $min %= 60;
|
||||
$hrs = int($hrs);
|
||||
return "$hrs:$min:$sec" if ( $hrs < 24 );
|
||||
}
|
||||
|
||||
# Calculate the days
|
||||
my $days = $hrs / 24, $hrs %= 24;
|
||||
$days = int($days);
|
||||
return "$days:$hrs:$min:$sec" if ( $days < 365 );
|
||||
if ( $hrs > 24 ) {
|
||||
$day = $hrs / 24, $hrs %= 24;
|
||||
$day = int($day);
|
||||
}
|
||||
|
||||
return ( $day, $hrs, $min, $sec );
|
||||
}
|
||||
|
||||
###############################################################
|
||||
|
|
|
@ -175,8 +175,8 @@ sub userBind {
|
|||
}
|
||||
if ( $resp->time_before_expiration ) {
|
||||
$self->{portal}->info( "<h3>"
|
||||
. $self->convertSec($resp->time_before_expiration) . " "
|
||||
. $self->msg(PM_PP_EXP_WARNING)
|
||||
. printf($self->msg( PM_PP_EXP_WARNING ),
|
||||
self->convertSec($resp->time_before_expiration))
|
||||
. "</h3>" );
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ sub error_fr {
|
|||
'Mot de passe trop récent',
|
||||
'Mot de passe utilisé trop récemment',
|
||||
' authentifications restantes, changez votre mot de passe !',
|
||||
' avant expiration de votre mot de passe, pensez à le changer !',
|
||||
'%d jours, %d heures, %d minutes et %d secondes avant expiration de votre mot de passe, pensez à le changer !',
|
||||
'Les mots de passe ne correspondent pas',
|
||||
'Le mot de passe a été changé',
|
||||
'Vous avez un nouveau message',
|
||||
|
@ -249,7 +249,7 @@ sub error_en {
|
|||
'Password too young',
|
||||
'Password used too recently',
|
||||
' authentications remaining, change your password!',
|
||||
' before password expiration, change it!',
|
||||
'%d days, %d hours, %d minutes and %d seconds before password expiration, change it!',
|
||||
'Passwords mismatch',
|
||||
'Password successfully changed',
|
||||
'You have a new message',
|
||||
|
@ -336,7 +336,7 @@ sub error_ro {
|
|||
'Prea parolă nouă',
|
||||
'Parola folosit prea recent',
|
||||
' authentications rămase, schimbaţi-vă parola!',
|
||||
' înainte de expirarea parola dvs., asiguraţi-vă pentru a schimba!',
|
||||
'%d zile, %d ora, %d minute şi %d secundes înainte de expirarea parola dvs., asiguraţi-vă pentru a schimba!',
|
||||
'Parolele nu se potrivesc',
|
||||
'Parola a fost schimbată',
|
||||
'Ai un mesaj nou',
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
# change 'tests => 1' to 'tests => last_test_to_print';
|
||||
|
||||
use Test::More tests => 11;
|
||||
use Test::More tests => 10;
|
||||
|
||||
BEGIN { use_ok( 'Lemonldap::NG::Portal::Simple', ':all' ) }
|
||||
|
||||
|
@ -94,6 +94,3 @@ ok( $p->process > 0, 'User OK' );
|
|||
# Cookie test
|
||||
ok( $p->{cookie}->[0]->value eq '1', 'Cookie value' );
|
||||
|
||||
# convertSec test
|
||||
ok($p->convertSec(650) eq '00:10:50', 'convertSec');
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user