Merge branch 'v2.0' into configuration-api

This commit is contained in:
Clément OUDOT 2019-12-04 11:11:16 +01:00
commit 924bf75d9b
3 changed files with 45 additions and 3 deletions

View File

@ -66,7 +66,7 @@ describe('00 Lemonldap::NG', function() {
browser.driver.findElement(by.xpath("//input[@name='password']")).sendKeys('ohwd');
browser.driver.findElement(by.xpath("//input[@name='checkLogins']")).click();
browser.driver.findElement(by.xpath("//button[@type='submit']")).click();
expect(browser.driver.findElement(by.css('[trmsg="5"]')).getText()).toEqual('Mot de passe ou identifiant incorrect');
expect(browser.driver.findElement(by.css('[trmsg="5"]')).getText()).toEqual('Identifiant ou mot de passe incorrect');
browser.driver.findElement(by.css('[trspan="goToPortal"]')).click();
// Login attempt

View File

@ -367,6 +367,7 @@ site/htdocs/static/languages/vi.json
site/htdocs/static/languages/zh.json
site/templates/bootstrap/2fchoice.tpl
site/templates/bootstrap/2fregisters.tpl
site/templates/bootstrap/captcha.tpl
site/templates/bootstrap/casBack2Url.tpl
site/templates/bootstrap/checklogins.tpl
site/templates/bootstrap/checkuser.tpl

View File

@ -6,7 +6,7 @@ require 't/test-lib.pm';
my $res;
my $maintests = 18;
my $maintests = 24;
SKIP: {
eval 'use GD::SecurityImage;use Image::Magick;';
if ($@) {
@ -47,7 +47,6 @@ m%<input name="password" type="text" class="form-control key" autocomplete="off"
explain( $res->[2]->[0], '<img id="captcha" src="data:image/png;base64' );
# Try to get captcha value
my ( $ts, $captcha );
ok( $ts = getCache()->get($token), ' Found token session' );
$ts = eval { JSON::from_json($ts) };
@ -113,6 +112,48 @@ m%<input name="password" type="text" class="form-control key" autocomplete="off"
ok( $newtoken ne $token, ' Token is refreshed' );
ok( $res->[2]->[0] =~ m#<img id="captcha" src="data:image/png;base64#,
' New captcha image inserted' );
# Try to renew captcha
ok( $res = $client->_get( '/renewcaptcha', accept => 'text/html' ),
'Unauth request to renew Captcha' );
my $json = eval { JSON::from_json( $res->[2]->[0] ) };
ok( ( defined $json->{newtoken} and $json->{newtoken} =~ /^\d{10}_\d+$/ ),
'New token has been received' )
or explain( $json->{newtoken}, 'NO token received' );
ok( (
defined $json->{newimage}
and $json->{newimage} =~ m%^data:image/png;base64,.+%
),
'New image has been received'
) or explain( $json->{newimage}, 'NO image received' );
# Try to submit new captcha
ok( $ts = getCache()->get( $json->{newtoken} ),
' Found new token session' );
$ts = eval { JSON::from_json($ts) };
$query =
"user=dwho&password=dwho&captcha=$ts->{captcha}&token=$json->{newtoken}";
ok(
$res = $client->_post(
'/',
IO::String->new($query),
length => length($query)
),
'Try to auth with new captcha value'
);
expectOK($res);
$id = expectCookie($res);
ok(
$res = $client->_get(
'/',
query => 'url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==',
cookie => "lemonldap=$id",
accept => 'text/html'
),
'Auth request with redirection'
);
expectRedirection( $res, 'http://test1.example.com/' );
expectAuthenticatedAs( $res, 'dwho' );
}
count($maintests);