Transform messsage into new form (#595)
This commit is contained in:
parent
c0cbdbec86
commit
08a02e93b9
|
@ -6,7 +6,7 @@ package Lemonldap::NG::Portal::Auth::AD;
|
|||
use strict;
|
||||
use Mouse;
|
||||
use Lemonldap::NG::Portal::Main::Constants
|
||||
qw(PE_OK PE_PP_PASSWORD_EXPIRED PE_PP_CHANGE_AFTER_RESET PM_PP_EXP_WARNING);
|
||||
qw(PE_OK PE_PP_PASSWORD_EXPIRED PE_PP_CHANGE_AFTER_RESET);
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
|
||||
|
@ -111,14 +111,14 @@ sub authenticate {
|
|||
my $remainingTime = $_pwdExpire - $timestamp;
|
||||
$self->info(
|
||||
$req,
|
||||
"<h3>"
|
||||
. sprintf(
|
||||
$self->msg(PM_PP_EXP_WARNING),
|
||||
$self->convertSec(
|
||||
'<h3 trspan="pwdWillExpire,'
|
||||
. join(
|
||||
',',
|
||||
$self->ldap->convertSec(
|
||||
substr( $remainingTime, 0, length($remainingTime) - 7 )
|
||||
)
|
||||
)
|
||||
. "</h3>"
|
||||
. '"></h3>'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -217,8 +217,7 @@ sub userBind {
|
|||
if ( $resp->time_before_expiration ) {
|
||||
$self->{portal}->info( $req,
|
||||
'<h3 trspan="authRemaining,'
|
||||
. $self->{portal}
|
||||
->convertSec( $resp->time_before_expiration )
|
||||
. $self->convertSec( $resp->time_before_expiration )
|
||||
. '"></h3>' );
|
||||
}
|
||||
|
||||
|
@ -676,4 +675,31 @@ sub getLdapValue {
|
|||
);
|
||||
}
|
||||
|
||||
# Convert seconds to hours, minutes, seconds
|
||||
sub convertSec {
|
||||
my ( $self, $sec ) = @_;
|
||||
my ( $day, $hrs, $min ) = ( 0, 0, 0 );
|
||||
|
||||
# Calculate the minutes
|
||||
if ( $sec > 60 ) {
|
||||
$min = $sec / 60, $sec %= 60;
|
||||
$min = int($min);
|
||||
}
|
||||
|
||||
# Calculate the hours
|
||||
if ( $min > 60 ) {
|
||||
$hrs = $min / 60, $min %= 60;
|
||||
$hrs = int($hrs);
|
||||
}
|
||||
|
||||
# Calculate the days
|
||||
if ( $hrs > 24 ) {
|
||||
$day = $hrs / 24, $hrs %= 24;
|
||||
$day = int($day);
|
||||
}
|
||||
|
||||
# Return the date
|
||||
return ( $day, $hrs, $min, $sec );
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user