Use Ajax request (#1976)
This commit is contained in:
parent
01cdeb8f8a
commit
ea80b4df0e
|
@ -483,14 +483,11 @@ sub display {
|
|||
$self->loadedModules->{
|
||||
"Lemonldap::NG::Portal::Plugins::FindUser"};
|
||||
my $fields = [];
|
||||
$fields = $plugin->buildForm()
|
||||
if ( $plugin
|
||||
&& $self->conf->{findUser}
|
||||
&& $self->conf->{impersonationRule}
|
||||
&& $self->conf->{findUserSearchingAttributes} )
|
||||
{
|
||||
$login = $req->data->{findUser};
|
||||
$fields = $plugin->buildForm();
|
||||
}
|
||||
&& $self->conf->{findUserSearchingAttributes} );
|
||||
|
||||
# Authentication loop
|
||||
if ( $self->conf->{authentication} eq 'Choice'
|
||||
|
@ -506,7 +503,6 @@ sub display {
|
|||
DISPLAY_OPENID_FORM => 0,
|
||||
DISPLAY_YUBIKEY_FORM => 0,
|
||||
FIELDS => $fields,
|
||||
SPOOFID => $login,
|
||||
FINDUSER => scalar @$fields
|
||||
);
|
||||
}
|
||||
|
@ -540,7 +536,6 @@ sub display {
|
|||
( $displayType eq "logo" ? $self->conf->{portal} : 0 ),
|
||||
MSG => $req->info(),
|
||||
FIELDS => $fields,
|
||||
SPOOFID => $login,
|
||||
FINDUSER => scalar @$fields
|
||||
);
|
||||
}
|
||||
|
|
|
@ -186,15 +186,16 @@ sub buildForm {
|
|||
|
||||
sub sendResult {
|
||||
my ( $self, $req, $error ) = @_;
|
||||
|
||||
if ($error) {
|
||||
eval { $self->p->_authentication->setSecurity($req) };
|
||||
if ($error) {
|
||||
return $req->wantJSON
|
||||
? $self->p->sendJSONresponse(
|
||||
$req,
|
||||
{
|
||||
user => '',
|
||||
error => $error
|
||||
error => $error,
|
||||
( $req->token ? ( token => $req->token ) : () ),
|
||||
( $req->captcha ? ( captcha => $req->captcha ) : () )
|
||||
}
|
||||
)
|
||||
: $self->p->do( $req, [ sub { $error } ] );
|
||||
|
@ -204,7 +205,9 @@ sub sendResult {
|
|||
$req,
|
||||
{
|
||||
user => ( $req->data->{findUser} ? $req->data->{findUser} : '' ),
|
||||
result => 1
|
||||
result => 1,
|
||||
( $req->token ? ( token => $req->token ) : () ),
|
||||
( $req->captcha ? ( captcha => $req->captcha ) : () )
|
||||
}
|
||||
)
|
||||
: $self->p->do( $req, [ sub { PE_FIRSTACCESS } ] );
|
||||
|
|
|
@ -216,7 +216,7 @@ setCookie = (name, value, exdays) ->
|
|||
# Function to change password using Ajax (instead of POST)
|
||||
# NOT USED FOR NOW
|
||||
#changePwd = (event) ->
|
||||
# event.preventDefault();
|
||||
# event.preventDefault()
|
||||
# $.ajax
|
||||
# type: 'POST'
|
||||
# url: datas['scriptname']
|
||||
|
@ -544,6 +544,25 @@ $(window).on 'load', () ->
|
|||
|
||||
#$('#formpass').on 'submit', changePwd
|
||||
|
||||
if window.location.href.match /\/finduser/
|
||||
console.log 'Set Portal URL: ' + portal
|
||||
window.history.pushState({page: 'Portal'}, 'Portal', portal)
|
||||
$('#finduserbutton').on 'click', (event) ->
|
||||
event.preventDefault()
|
||||
str = $("#finduserform").serialize()
|
||||
console.log 'Send findUser request with', str
|
||||
$.ajax
|
||||
type: "POST"
|
||||
url: "#{portal}finduser"
|
||||
dataType: 'json'
|
||||
data: str
|
||||
# On success, value are set
|
||||
success: (data) ->
|
||||
user = data.user
|
||||
console.log 'Suggested spoofId', user
|
||||
$('#spoofIdfield').attr 'value', user
|
||||
$('#captcha').attr 'src', data.captcha if data.captcha
|
||||
if data.token
|
||||
$('#findusertoken').attr 'value', data.token
|
||||
$('#token').attr 'value', data.token
|
||||
error: (j) ->
|
||||
res = JSON.parse j.responseText if j
|
||||
if res and res.error
|
||||
console.log 'Returned error', res
|
|
@ -587,12 +587,38 @@ LemonLDAP::NG Portal jQuery scripts
|
|||
return $("#show-hide-icon-button").addClass('fa-eye');
|
||||
}
|
||||
});
|
||||
if (window.location.href.match(/\/finduser/)) {
|
||||
console.log('Set Portal URL: ' + portal);
|
||||
return window.history.pushState({
|
||||
page: 'Portal'
|
||||
}, 'Portal', portal);
|
||||
return $('#finduserbutton').on('click', function(event) {
|
||||
var str;
|
||||
event.preventDefault();
|
||||
str = $("#finduserform").serialize();
|
||||
console.log('Send findUser request with', str);
|
||||
return $.ajax({
|
||||
type: "POST",
|
||||
url: portal + "finduser",
|
||||
dataType: 'json',
|
||||
data: str,
|
||||
success: function(data) {
|
||||
var user;
|
||||
user = data.user;
|
||||
console.log('Suggested spoofId', user);
|
||||
$('#spoofIdfield').attr('value', user);
|
||||
if (data.captcha) {
|
||||
$('#captcha').attr('src', data.captcha);
|
||||
}
|
||||
if (data.token) {
|
||||
$('#findusertoken').attr('value', data.token);
|
||||
return $('#token').attr('value', data.token);
|
||||
}
|
||||
},
|
||||
error: function(j) {
|
||||
var res;
|
||||
res = JSON.parse(j.responseText);
|
||||
if (res && res.error) {
|
||||
return console.log('Returned error', res);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,10 +2,10 @@
|
|||
<br>
|
||||
<div class="card">
|
||||
<br>
|
||||
<form action="/finduser" id="searchAccount" method="post" role="form" class="login">
|
||||
<form id="finduserform" role="form" class="login">
|
||||
<div class="form">
|
||||
<TMPL_IF NAME="TOKEN">
|
||||
<input type="hidden" name="token" value="<TMPL_VAR NAME="TOKEN">" />
|
||||
<input id="findusertoken" type="hidden" name="token" value="<TMPL_VAR NAME="TOKEN">" />
|
||||
</TMPL_IF>
|
||||
<TMPL_LOOP NAME="FIELDS">
|
||||
<TMPL_IF NAME="select">
|
||||
|
@ -29,7 +29,7 @@
|
|||
</div>
|
||||
</TMPL_IF>
|
||||
</TMPL_LOOP>
|
||||
<button type="submit" class="btn btn-info" >
|
||||
<button id="finduserbutton" class="btn btn-info" >
|
||||
<span class="fa fa-eye"></span>
|
||||
<span trspan="searchAccount">Search for an account</span>
|
||||
</button>
|
||||
|
|
|
@ -50,7 +50,7 @@ ok(
|
|||
accept => 'text/html',
|
||||
length => length($query)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
|
|
|
@ -7,6 +7,7 @@ require 't/test-lib.pm';
|
|||
|
||||
my $res;
|
||||
my $json;
|
||||
my $token;
|
||||
my $client = LLNG::Manager::Test->new( {
|
||||
ini => {
|
||||
logLevel => 'error',
|
||||
|
@ -50,13 +51,14 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($query)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
ok( $json->{user} eq 'dwho', ' Good user' )
|
||||
or explain( $json, 'user => dwho' );
|
||||
count(3);
|
||||
ok( $token = $json->{token}, 'Found token' );
|
||||
count(4);
|
||||
|
||||
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Get Portal', );
|
||||
( $host, $url, $query ) =
|
||||
|
@ -69,7 +71,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($query)
|
||||
),
|
||||
'Post expired FindFuser request'
|
||||
'Post expired FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -77,7 +79,8 @@ ok( $json->{error} == 82, ' Token expired' )
|
|||
or explain( $json, 'Token expired' );
|
||||
ok( $json->{result} == 0, ' result => 0' )
|
||||
or explain( $json, 'Result => 0' );
|
||||
count(5);
|
||||
ok( $token = $json->{token}, 'Found token' );
|
||||
count(6);
|
||||
|
||||
clean_sessions();
|
||||
done_testing( count() );
|
||||
|
|
|
@ -8,7 +8,7 @@ require 't/test-lib.pm';
|
|||
my $res;
|
||||
my $json;
|
||||
my $request;
|
||||
my $maintests = 24;
|
||||
my $maintests = 23;
|
||||
|
||||
SKIP: {
|
||||
skip 'LLNGTESTLDAP is not set', $maintests unless ( $ENV{LLNGTESTLDAP} );
|
||||
|
@ -50,7 +50,7 @@ SKIP: {
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post empty FindFuser request'
|
||||
'Post empty FindUser request'
|
||||
);
|
||||
( $host, $url, $query ) =
|
||||
expectForm( $res, '#', undef, 'user', 'password', 'spoofId' );
|
||||
|
@ -68,10 +68,8 @@ m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $res->[2]->[0] =~ m%value="dwho"%, 'value="dwho"' )
|
||||
or explain( $res->[2]->[0], 'value="dwho"' );
|
||||
ok( $res->[2]->[0] =~ m%autocomplete="off"%, 'autocomplete="off"' )
|
||||
or explain( $res->[2]->[0], 'autocomplete="off"' );
|
||||
ok(
|
||||
|
@ -97,7 +95,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -111,7 +109,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with bad user'
|
||||
'Post FindUser request with bad user'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -127,7 +125,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with excluding result'
|
||||
'Post FindUser request with excluding result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -143,7 +141,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with excluding result'
|
||||
'Post FindUser request with excluding result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
|
|
@ -5,7 +5,7 @@ use IO::String;
|
|||
|
||||
require 't/test-lib.pm';
|
||||
|
||||
my $maintests = 54;
|
||||
my $maintests = 53;
|
||||
my $userdb = tempdb();
|
||||
|
||||
SKIP: {
|
||||
|
@ -84,7 +84,7 @@ SKIP: {
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post empty FindFuser request'
|
||||
'Post empty FindUser request'
|
||||
);
|
||||
( $host, $url, $query ) =
|
||||
expectForm( $res, '#', undef, 'user', 'password', 'spoofId' );
|
||||
|
@ -103,10 +103,8 @@ m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $res->[2]->[0] =~ m%value="dwho"%, 'value="dwho"' )
|
||||
or explain( $res->[2]->[0], 'value="dwho"' );
|
||||
ok( $res->[2]->[0] =~ m%autocomplete="off"%, 'autocomplete="off"' )
|
||||
or explain( $res->[2]->[0], 'autocomplete="off"' );
|
||||
ok(
|
||||
|
@ -142,7 +140,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -156,7 +154,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request no result'
|
||||
'Post FindUser request no result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -170,7 +168,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request one result'
|
||||
'Post FindUser request one result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -184,7 +182,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request multi results'
|
||||
'Post FindUser request multi results'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -198,7 +196,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with bad arg'
|
||||
'Post FindUser request with bad arg'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -214,7 +212,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with two args'
|
||||
'Post FindUser request with two args'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -228,7 +226,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with wrong args'
|
||||
'Post FindUser request with wrong args'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -244,7 +242,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with excluding result'
|
||||
'Post FindUser request with excluding result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -260,7 +258,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with excluding result'
|
||||
'Post FindUser request with excluding result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -276,7 +274,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request 0 with multi results'
|
||||
'Post FindUser request 0 with multi results'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -292,7 +290,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with bad wildcard'
|
||||
'Post FindUser request with bad wildcard'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -308,7 +306,7 @@ m%<input id="findUser_room" name="room" type="text" autocomplete="off" class="fo
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with wildcard'
|
||||
'Post FindUser request with wildcard'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
|
|
@ -5,7 +5,7 @@ use IO::String;
|
|||
|
||||
require 't/test-lib.pm';
|
||||
|
||||
my $maintests = 26;
|
||||
my $maintests = 25;
|
||||
|
||||
my $res;
|
||||
my $json;
|
||||
|
@ -46,7 +46,7 @@ ok(
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post empty FindFuser request'
|
||||
'Post empty FindUser request'
|
||||
);
|
||||
( $host, $url, $query ) =
|
||||
expectForm( $res, '#', undef, 'user', 'password', 'spoofId' );
|
||||
|
@ -64,10 +64,8 @@ ok(
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $res->[2]->[0] =~ m%value="davros"%, 'value="davros"' )
|
||||
or explain( $res->[2]->[0], 'value="davros"' );
|
||||
ok( $res->[2]->[0] =~ m%autocomplete="off"%, 'autocomplete="off"' )
|
||||
or explain( $res->[2]->[0], 'autocomplete="off"' );
|
||||
ok(
|
||||
|
@ -110,7 +108,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -124,7 +122,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -140,7 +138,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
|
|
@ -47,7 +47,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($query)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -66,7 +66,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($query)
|
||||
),
|
||||
'Post expired FindFuser request'
|
||||
'Post expired FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -86,7 +86,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($query)
|
||||
),
|
||||
'Post FindFuser request without token'
|
||||
'Post FindUser request without token'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -108,7 +108,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($query)
|
||||
),
|
||||
'Post FindFuser request with token'
|
||||
'Post FindUser request with token'
|
||||
);
|
||||
my $id = expectCookie($res);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
|
|
|
@ -5,7 +5,7 @@ use IO::String;
|
|||
|
||||
require 't/test-lib.pm';
|
||||
|
||||
my $maintests = 54;
|
||||
my $maintests = 53;
|
||||
|
||||
my $res;
|
||||
my $json;
|
||||
|
@ -45,7 +45,7 @@ ok(
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post empty FindFuser request'
|
||||
'Post empty FindUser request'
|
||||
);
|
||||
( $host, $url, $query ) =
|
||||
expectForm( $res, '#', undef, 'user', 'password', 'spoofId' );
|
||||
|
@ -63,10 +63,8 @@ ok(
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $res->[2]->[0] =~ m%value="dwho"%, 'value="dwho"' )
|
||||
or explain( $res->[2]->[0], 'value="dwho"' );
|
||||
ok( $res->[2]->[0] =~ m%autocomplete="off"%, 'autocomplete="off"' )
|
||||
or explain( $res->[2]->[0], 'autocomplete="off"' );
|
||||
ok(
|
||||
|
@ -106,7 +104,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -120,7 +118,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with bad user'
|
||||
'Post FindUser request with bad user'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -136,7 +134,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request one result'
|
||||
'Post FindUser request one result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -150,7 +148,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with a not allowed select value'
|
||||
'Post FindUser request with a not allowed select value'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -166,7 +164,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request multi results'
|
||||
'Post FindUser request multi results'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -180,7 +178,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with bad arg'
|
||||
'Post FindUser request with bad arg'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -196,7 +194,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with two args'
|
||||
'Post FindUser request with two args'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -210,7 +208,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with wrong args'
|
||||
'Post FindUser request with wrong args'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -226,7 +224,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with excluding result'
|
||||
'Post FindUser request with excluding result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -242,7 +240,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with excluding result'
|
||||
'Post FindUser request with excluding result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -258,7 +256,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with wildcard'
|
||||
'Post FindUser request with wildcard'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
|
|
@ -8,7 +8,7 @@ require 't/test-lib.pm';
|
|||
my $res;
|
||||
my $json;
|
||||
my $request;
|
||||
my $maintests = 46;
|
||||
my $maintests = 45;
|
||||
|
||||
SKIP: {
|
||||
skip 'LLNGTESTLDAP is not set', $maintests unless ( $ENV{LLNGTESTLDAP} );
|
||||
|
@ -58,7 +58,7 @@ SKIP: {
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post empty FindFuser request'
|
||||
'Post empty FindUser request'
|
||||
);
|
||||
( $host, $url, $query ) =
|
||||
expectForm( $res, '#', undef, 'user', 'password', 'spoofId' );
|
||||
|
@ -77,10 +77,8 @@ m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value
|
|||
accept => 'text/html',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $res->[2]->[0] =~ m%value="dwho"%, 'value="dwho"' )
|
||||
or explain( $res->[2]->[0], 'value="dwho"' );
|
||||
ok( $res->[2]->[0] =~ m%autocomplete="off"%, 'autocomplete="off"' )
|
||||
or explain( $res->[2]->[0], 'autocomplete="off"' );
|
||||
ok(
|
||||
|
@ -111,7 +109,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -125,7 +123,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with bad user'
|
||||
'Post FindUser request with bad user'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -141,7 +139,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request one result'
|
||||
'Post FindUser request one result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -155,7 +153,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request multi results'
|
||||
'Post FindUuser request multi results'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -169,7 +167,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with bad arg'
|
||||
'Post FindUser request with bad arg'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -185,7 +183,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with two args'
|
||||
'Post FindUser request with two args'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -199,7 +197,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with wrong args'
|
||||
'Post FindUser request with wrong args'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -215,7 +213,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with excluding result'
|
||||
'Post FindUser request with excluding result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -231,7 +229,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with excluding result'
|
||||
'Post FindUser request with excluding result'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -247,7 +245,7 @@ m%<input id="findUser_cn" name="cn" type="text" autocomplete="off" class="form-c
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request with wildcard'
|
||||
'Post FindUser request with wildcard'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
|
|
@ -101,7 +101,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post good FindFuser request'
|
||||
'Post good FindUser request'
|
||||
);
|
||||
expectOK($res);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
|
@ -119,7 +119,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post null response FindFuser request'
|
||||
'Post null response FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
@ -136,7 +136,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post bad parameter FindFuser request'
|
||||
'Post bad parameter FindUser request'
|
||||
);
|
||||
expectOK($res);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
|
@ -154,7 +154,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post empty response FindFuser request'
|
||||
'Post empty response FindUser request'
|
||||
);
|
||||
expectOK($res);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
|
@ -172,7 +172,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post multi responses FindFuser request'
|
||||
'Post multi responses FindUser request'
|
||||
);
|
||||
expectOK($res);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
|
|
|
@ -42,7 +42,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
|
|
@ -41,7 +41,7 @@ ok(
|
|||
accept => 'application/json',
|
||||
length => length($request)
|
||||
),
|
||||
'Post FindFuser request'
|
||||
'Post FindUser request'
|
||||
);
|
||||
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
||||
or print STDERR "$@\n" . Dumper($res);
|
||||
|
|
Loading…
Reference in New Issue
Block a user