Remove userData if authentication fails (#1666)
This commit is contained in:
parent
4366488fb6
commit
9798c78068
|
@ -210,6 +210,12 @@ sub do {
|
||||||
if ( $err == PE_SENDRESPONSE ) {
|
if ( $err == PE_SENDRESPONSE ) {
|
||||||
return $req->response;
|
return $req->response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove userData if authentication fails
|
||||||
|
if ( $err == PE_BADCREDENTIALS ) {
|
||||||
|
$req->userData( {} );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !$self->conf->{noAjaxHook} and $req->wantJSON ) {
|
if ( !$self->conf->{noAjaxHook} and $req->wantJSON ) {
|
||||||
$self->logger->debug('Processing to JSON response');
|
$self->logger->debug('Processing to JSON response');
|
||||||
if ( ( $err > 0 and !$req->id ) or $err eq PE_SESSIONNOTGRANTED ) {
|
if ( ( $err > 0 and !$req->id ) or $err eq PE_SESSIONNOTGRANTED ) {
|
||||||
|
|
|
@ -29,8 +29,53 @@ ok( $res->[2]->[0] =~ m%<span id="languages"></span>%, ' Language icons found' )
|
||||||
or print STDERR Dumper( $res->[2]->[0] );
|
or print STDERR Dumper( $res->[2]->[0] );
|
||||||
count(2);
|
count(2);
|
||||||
|
|
||||||
# Try to authenticate
|
# Try to authenticate with unknown user
|
||||||
# -------------------
|
# -------------------------------------
|
||||||
|
ok(
|
||||||
|
$res = $client->_post(
|
||||||
|
'/',
|
||||||
|
IO::String->new('user=jdoe&password=jdoe'),
|
||||||
|
accept => 'text/html',
|
||||||
|
length => 23
|
||||||
|
),
|
||||||
|
'Auth query'
|
||||||
|
);
|
||||||
|
count(1);
|
||||||
|
ok(
|
||||||
|
$res->[2]->[0] =~ /<span trmsg="5"><\/span><\/div>/,
|
||||||
|
'jdoe rejected with PE_BADCREDENTIALS'
|
||||||
|
) or print STDERR Dumper( $res->[2]->[0] );
|
||||||
|
count(1);
|
||||||
|
ok( $res->[2]->[0] =~ m%<span trspan="connect">Connect</span>%,
|
||||||
|
'Found connect button' )
|
||||||
|
or print STDERR Dumper( $res->[2]->[0] );
|
||||||
|
count(1);
|
||||||
|
|
||||||
|
# Try to authenticate with bad password
|
||||||
|
# -------------------------------------
|
||||||
|
ok(
|
||||||
|
$res = $client->_post(
|
||||||
|
'/',
|
||||||
|
IO::String->new('user=dwho&password=jdoe'),
|
||||||
|
accept => 'text/html',
|
||||||
|
length => 23
|
||||||
|
),
|
||||||
|
'Auth query'
|
||||||
|
);
|
||||||
|
count(1);
|
||||||
|
ok(
|
||||||
|
$res->[2]->[0] =~ /<span trmsg="5"><\/span><\/div>/,
|
||||||
|
'dwho rejected with PE_BADCREDENTIALS'
|
||||||
|
) or print STDERR Dumper( $res->[2]->[0] );
|
||||||
|
count(1);
|
||||||
|
ok( $res->[2]->[0] =~ m%<span trspan="connect">Connect</span>%,
|
||||||
|
'Found connect button' )
|
||||||
|
or print STDERR Dumper( $res->[2]->[0] );
|
||||||
|
count(1);
|
||||||
|
|
||||||
|
|
||||||
|
# Try to authenticate with good password
|
||||||
|
# --------------------------------------
|
||||||
ok(
|
ok(
|
||||||
$res = $client->_post(
|
$res = $client->_post(
|
||||||
'/',
|
'/',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user