Commit 8786c6ba authored by dcoutadeur dcoutadeur's avatar dcoutadeur dcoutadeur

Adding more tests for #1245 (adding salt feature for database backend)

parent 251e78d5
......@@ -81,7 +81,7 @@ use IO::String;
require 't/test-lib.pm';
my $res;
my $mainTests = 3;
my $mainTests = 6;
eval { unlink 't/userdb.db' };
......@@ -164,8 +164,43 @@ SKIP: {
);
expectOK($res);
$id = expectCookie($res);
# Try to modify password
ok(
$res = $client->_post(
'/',
IO::String->new(
'oldpassword=secret3&newpassword=secret4&confirmpassword=secret4'),
cookie => "lemonldap=$id",
accept => 'application/json',
length => 63
),
'Change password'
);
expectOK($res);
$client->logout($id);
# Try to authenticate against new salted password
ok(
$res = $client->_post(
'/',
IO::String->new('user=jsmith&password=secret4'),
length => 28
),
'Authentication against newly-modified password'
);
expectOK($res);
my $id = expectCookie($res);
# Verify that password is hashed with correct scheme (dbiDynamicHashNewPasswordScheme)
my $sth = $dbh->prepare("SELECT password FROM users WHERE user='jsmith';");
$sth->execute();
my $row = $sth->fetchrow_array;
ok(
$row =~ /^{ssha256}/,
'Verify that password is hashed with correct scheme'
);
clean_sessions();
}
eval { unlink 't/userdb.db' };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment