Improve RegExp (#1629)

This commit is contained in:
Christophe Maudoux 2019-02-03 21:48:49 +01:00
parent fcac69fe7a
commit e41be10a23
5 changed files with 9 additions and 9 deletions

View File

@ -120,7 +120,7 @@ sub defaultValues {
'logoutServices' => {}, 'logoutServices' => {},
'macros' => {}, 'macros' => {},
'mail2fActivation' => 0, 'mail2fActivation' => 0,
'mail2fCodeRegex' => '\\d\\d\\d\\d\\d\\d', 'mail2fCodeRegex' => '\\d{6}',
'mailCharset' => 'utf-8', 'mailCharset' => 'utf-8',
'mailFrom' => 'noreply@example.com', 'mailFrom' => 'noreply@example.com',
'mailSessionKey' => 'mail', 'mailSessionKey' => 'mail',

View File

@ -1573,7 +1573,7 @@ qr/^(?:\*\.)?(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][
'type' => 'longtext' 'type' => 'longtext'
}, },
'mail2fCodeRegex' => { 'mail2fCodeRegex' => {
'default' => '\\d\\d\\d\\d\\d\\d', 'default' => '\\d{6}',
'type' => 'pcre' 'type' => 'pcre'
}, },
'mail2fLogo' => { 'mail2fLogo' => {
@ -3095,19 +3095,19 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
'default' => 0, 'default' => 0,
'select' => [ 'select' => [
{ {
'k' => 0, 'k' => '0',
'v' => 'unsecuredCookie' 'v' => 'unsecuredCookie'
}, },
{ {
'k' => 1, 'k' => '1',
'v' => 'securedCookie' 'v' => 'securedCookie'
}, },
{ {
'k' => 2, 'k' => '2',
'v' => 'doubleCookie' 'v' => 'doubleCookie'
}, },
{ {
'k' => 3, 'k' => '3',
'v' => 'doubleCookieForSingleSession' 'v' => 'doubleCookieForSingleSession'
} }
], ],

View File

@ -1319,7 +1319,7 @@ sub attributes {
}, },
mail2fCodeRegex => { mail2fCodeRegex => {
type => 'pcre', type => 'pcre',
default => '\d\d\d\d\d\d', default => '\d{6}',
documentation => 'Regular expression to create a mail OTP code', documentation => 'Regular expression to create a mail OTP code',
}, },
mail2fTimeout => { mail2fTimeout => {

File diff suppressed because one or more lines are too long

View File

@ -44,7 +44,7 @@ qr%<input name="code" value="" class="form-control" id="extcode" trplaceholder="
) or print STDERR Dumper( $res->[2]->[0] ); ) or print STDERR Dumper( $res->[2]->[0] );
count(1); count(1);
ok( mail() =~ m%<b>(\d\d\d\d)</b>%, 'Found 2F code in mail' ) ok( mail() =~ m%<b>(\d{4})</b>%, 'Found 2F code in mail' )
or print STDERR Dumper( mail() ); or print STDERR Dumper( mail() );
my $code = $1; my $code = $1;