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' => {},
'macros' => {},
'mail2fActivation' => 0,
'mail2fCodeRegex' => '\\d\\d\\d\\d\\d\\d',
'mail2fCodeRegex' => '\\d{6}',
'mailCharset' => 'utf-8',
'mailFrom' => 'noreply@example.com',
'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'
},
'mail2fCodeRegex' => {
'default' => '\\d\\d\\d\\d\\d\\d',
'default' => '\\d{6}',
'type' => 'pcre'
},
'mail2fLogo' => {
@ -3095,19 +3095,19 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
'default' => 0,
'select' => [
{
'k' => 0,
'k' => '0',
'v' => 'unsecuredCookie'
},
{
'k' => 1,
'k' => '1',
'v' => 'securedCookie'
},
{
'k' => 2,
'k' => '2',
'v' => 'doubleCookie'
},
{
'k' => 3,
'k' => '3',
'v' => 'doubleCookieForSingleSession'
}
],

View File

@ -1319,7 +1319,7 @@ sub attributes {
},
mail2fCodeRegex => {
type => 'pcre',
default => '\d\d\d\d\d\d',
default => '\d{6}',
documentation => 'Regular expression to create a mail OTP code',
},
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] );
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() );
my $code = $1;