Modify test & cookieExpiration value type (#1485)

This commit is contained in:
Christophe Maudoux 2018-07-30 19:18:06 +02:00
parent 7d67e6225d
commit 9c5997486f
4 changed files with 8 additions and 11 deletions

View File

@ -887,7 +887,7 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
'type' => 'select'
},
'cookieExpiration' => {
'type' => 'text'
'type' => 'int'
},
'cookieName' => {
'default' => 'lemonldap',

View File

@ -743,7 +743,7 @@ sub attributes {
# Cookies
cookieExpiration => {
type => 'text',
type => 'int',
documentation => 'Cookie expiration',
flags => 'hp',
},

View File

@ -253,14 +253,11 @@ sub tests {
# Warn if cookie TTL is equal or lower than one hour
cookieTTL => sub {
return 1 unless ( defined $conf->{cookieExpiration} );
if ( $conf->{cookieExpiration} =~ /^(\d+)s?$/ ) {
return ( 1, "Cookie TTL should be higher than one hour" )
unless ( $1 > 3600 );
}
if ( $conf->{cookieExpiration} =~ /^(\d+)m$/ ) {
return ( 1, "Cookie TTL should be higher than one hour" )
unless ( $1 > 60 );
}
return ( 0, "Cookie TTL must be higher than one minute" )
unless ( $conf->{cookieExpiration} > 60 );
return ( 1, "Cookie TTL should be higher or equal than one hour" )
unless ( $conf->{cookieExpiration} >= 3600
|| $conf->{cookieExpiration} == 0 );
# Return
return 1;

File diff suppressed because one or more lines are too long