Merge branch 'v3.2' into feature/cli_module

# Conflicts:
#	composer.json
#	composer.lock
#	lib/SP/Providers/Auth/Ldap/LdapMsAds.php
#	lib/SP/Services/Install/Installer.php
#	lib/SP/Util/Checks.php
#	lib/SP/Util/Link.php
#	public/js/app-actions.min.js
#	public/js/app-util.min.js
#	tests/res/scripts/reset_db.sh
This commit is contained in:
Rubén D
2021-09-19 21:40:27 +02:00
11 changed files with 7721 additions and 35 deletions

View File

@@ -23,7 +23,7 @@ before_script:
- composer self-update
- composer install --prefer-source --no-interaction --dev
script: ./vendor/bin/phpunit -c ./tests/phpunit.xml --testsuite Core
script: XDEBUG_MODE=coverage ./vendor/bin/phpunit -c ./tests/phpunit.xml --testsuite Core
after_script:
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then mv ./tests/_output/coverage-clover.xml clover.xml && ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT -t clover; fi

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -52,6 +52,12 @@ final class InstallController extends ControllerBase
*/
public function indexAction()
{
if ($this->configData->isInstalled()) {
$this->router->response()
->redirect('index.php?r=login');
return;
}
$layoutHelper = $this->dic->get(LayoutHelper::class);
$layoutHelper->getPublicLayout('index', 'install');

View File

@@ -295,7 +295,7 @@ final class Bootstrap
if (!self::$checkPhpVersion) {
throw new InitializationException(
sprintf(__('Required PHP version >= %s <= %s'), '7.0', '7.3'),
sprintf(__('Required PHP version >= %s <= %s'), '7.3', '7.4'),
InitializationException::ERROR,
__u('Please update the PHP version to run sysPass')
);

View File

@@ -79,7 +79,8 @@ final class Language
'pt_BR' => 'Português',
'it_IT' => 'Italiano',
'da' => 'Dansk',
'fo' => 'Føroyskt mál'
'fo' => 'Føroyskt mál',
'ja_JP' => '日本語',
];
/**
* @var ConfigData
@@ -237,4 +238,4 @@ final class Language
{
return file_exists(LOCALES_PATH . DIRECTORY_SEPARATOR . $lang);
}
}
}

View File

@@ -171,8 +171,10 @@ final class Request
$forwarded = $this->headers->get('HTTP_FORWARDED');
if ($forwarded !== null &&
preg_match_all('/(?:for=([\w.:]+))|(?:for="\[([\w.:]+)\]")/i',
$forwarded, $matches)
preg_match_all(
'/(?:for=([\w.:]+))|(?:for="\[([\w.:]+)\]")/i',
$forwarded,
$matches)
) {
return array_filter(array_merge($matches[1], $matches[2]), function ($value) {
return !empty($value);
@@ -180,7 +182,7 @@ final class Request
}
// eg: X-Forwarded-For: 192.0.2.43, 2001:db8:cafe::17
$xForwarded = $this->headers->exists('HTTP_X_FORWARDED_FOR');
$xForwarded = $this->headers->get('HTTP_X_FORWARDED_FOR');
if ($xForwarded !== null) {
$matches = preg_split('/(?<=[\w])+,\s?/i',

View File

@@ -219,6 +219,25 @@ final class LdapConnection implements LdapConnectionInterface
return 'ldap://' . $server . ':' . $port;
}
/**
* @inheritDoc
*/
public function getServerUri(): string
{
$server = $this->getServer();
$port = $this->ldapParams->getPort();
if (strpos($server, '://') !== false) {
return $server . ':' . $port;
} elseif ($port === 389 || $port === null) {
return 'ldap://' . $server;
} elseif ($port === 636) {
return 'ldaps://' . $server;
}
return 'ldap://' . $server . ':' . $port;
}
/**
* Connect through TLS
*

View File

@@ -20,7 +20,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\Services\Install;
@@ -59,9 +59,9 @@ final class Installer extends Service
/**
* sysPass' version and build number
*/
public const VERSION = [3, 2, 0];
public const VERSION_TEXT = '3.2';
public const BUILD = 20062901;
const VERSION = [3, 2, 2];
const VERSION_TEXT = '3.2';
const BUILD = 21031301;
/**
* @var DatabaseSetupInterface

View File

@@ -1466,30 +1466,7 @@ sysPass.Actions = function (log) {
log.info("plugin:nav");
grid.nav($obj);
},
delete: function ($obj) {
log.info("plugin:delete");
grid.delete($obj, function (items) {
const opts = sysPassApp.requests.getRequestOpts();
opts.method = "get";
opts.url = sysPassApp.util.getUrl(ajaxUrl.entrypoint,
{
r: [$obj.data("action-route"), (items.length === 0 ? $obj.data("item-id") : null)],
sk: sysPassApp.sk.get(),
isAjax: 1
});
opts.data = {items: items};
sysPassApp.requests.getActionCall(opts, function (json) {
sysPassApp.msg.out(json);
if (json.status === 0) {
getContent({r: $obj.data("action-next")});
}
});
});
},
}
};
/**

View File

@@ -51,6 +51,7 @@ class SecureSessionServiceTest extends TestCase
$service = $dic->get(SecureSessionService::class);
$stub = $this->createMock(UUIDCookie::class);
$stub->method('loadCookie')
->willReturn(uniqid('', true));
$stub->method('createCookie')