Fix update token with global storage (#1742)
This commit is contained in:
parent
682b193477
commit
05cd4d4a58
|
@ -536,6 +536,7 @@ t/76-2F-Ext-with-BruteForce.t
|
||||||
t/76-2F-Ext-with-CodeActivation.t
|
t/76-2F-Ext-with-CodeActivation.t
|
||||||
t/76-2F-Ext-with-GrantSession.t
|
t/76-2F-Ext-with-GrantSession.t
|
||||||
t/76-2F-Ext-with-History.t
|
t/76-2F-Ext-with-History.t
|
||||||
|
t/77-2F-Mail-with-global-storage.t
|
||||||
t/77-2F-Mail.t
|
t/77-2F-Mail.t
|
||||||
t/90-Translations.t
|
t/90-Translations.t
|
||||||
t/99-pod.t
|
t/99-pod.t
|
||||||
|
|
|
@ -5,7 +5,7 @@ use Mouse;
|
||||||
use JSON qw(from_json to_json);
|
use JSON qw(from_json to_json);
|
||||||
use Crypt::URandom;
|
use Crypt::URandom;
|
||||||
|
|
||||||
our $VERSION = '2.0.2';
|
our $VERSION = '2.0.4';
|
||||||
|
|
||||||
extends 'Lemonldap::NG::Common::Module';
|
extends 'Lemonldap::NG::Common::Module';
|
||||||
|
|
||||||
|
@ -134,7 +134,11 @@ sub updateToken {
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$self->p->getApacheSession( $id, $k => $v );
|
$self->p->getApacheSession(
|
||||||
|
$id,
|
||||||
|
kind => "TOKEN",
|
||||||
|
info => { $k => $v }
|
||||||
|
);
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
70
lemonldap-ng-portal/t/77-2F-Mail-with-global-storage.t
Normal file
70
lemonldap-ng-portal/t/77-2F-Mail-with-global-storage.t
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
use Test::More;
|
||||||
|
use strict;
|
||||||
|
use IO::String;
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
|
require 't/test-lib.pm';
|
||||||
|
require 't/smtp.pm';
|
||||||
|
|
||||||
|
use_ok('Lemonldap::NG::Common::FormEncode');
|
||||||
|
count(1);
|
||||||
|
|
||||||
|
my $client = LLNG::Manager::Test->new( {
|
||||||
|
ini => {
|
||||||
|
logLevel => 'error',
|
||||||
|
mail2fActivation => 1,
|
||||||
|
mail2fCodeRegex => '\d{4}',
|
||||||
|
authentication => 'Demo',
|
||||||
|
userDB => 'Same',
|
||||||
|
tokenUseGlobalStorage => 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
# Try to authenticate
|
||||||
|
# -------------------
|
||||||
|
ok(
|
||||||
|
my $res = $client->_post(
|
||||||
|
'/',
|
||||||
|
IO::String->new('user=dwho&password=dwho'),
|
||||||
|
length => 23,
|
||||||
|
accept => 'text/html',
|
||||||
|
),
|
||||||
|
'Auth query'
|
||||||
|
);
|
||||||
|
count(1);
|
||||||
|
|
||||||
|
my ( $host, $url, $query ) =
|
||||||
|
expectForm( $res, undef, '/mail2fcheck', 'token', 'code' );
|
||||||
|
|
||||||
|
ok(
|
||||||
|
$res->[2]->[0] =~
|
||||||
|
qr%<input name="code" value="" class="form-control" id="extcode" trplaceholder="code" autocomplete="off" />%,
|
||||||
|
'Found EXTCODE input'
|
||||||
|
) or print STDERR Dumper( $res->[2]->[0] );
|
||||||
|
count(1);
|
||||||
|
|
||||||
|
ok( mail() =~ m%<b>(\d{4})</b>%, 'Found 2F code in mail' )
|
||||||
|
or print STDERR Dumper( mail() );
|
||||||
|
|
||||||
|
my $code = $1;
|
||||||
|
count(1);
|
||||||
|
|
||||||
|
$query =~ s/code=/code=${code}/;
|
||||||
|
ok(
|
||||||
|
$res = $client->_post(
|
||||||
|
'/mail2fcheck',
|
||||||
|
IO::String->new($query),
|
||||||
|
length => length($query),
|
||||||
|
accept => 'text/html',
|
||||||
|
),
|
||||||
|
'Post code'
|
||||||
|
);
|
||||||
|
count(1);
|
||||||
|
my $id = expectCookie($res);
|
||||||
|
$client->logout($id);
|
||||||
|
|
||||||
|
clean_sessions();
|
||||||
|
|
||||||
|
done_testing( count() );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user