mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-13 20:06:57 +01:00
Merge branch 'master' into auth
Conflicts: inc/SP/Auth/Ldap/LdapBase.class.php inc/SP/Controller/ItemShowController.class.php inc/SP/Controller/LoginController.class.php inc/SP/Core/Init.class.php inc/SP/Util/Util.class.php inc/locales/en_US/LC_MESSAGES/messages.mo inc/locales/en_US/LC_MESSAGES/messages.po inc/themes/material-blue/css/styles.min.css inc/themes/material-blue/views/main/login.inc js/app-main.min.js js/app-triggers.min.js
This commit is contained in:
@@ -337,16 +337,6 @@ abstract class LdapBase implements LdapInterface, AuthInterface
|
||||
$this->serverPort = $this->getServerPort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver el puerto del servidor si está establecido
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function getServerPort()
|
||||
{
|
||||
return preg_match('/[\d\.]+:(\d+)/', $this->server, $port) ? $port[1] : 389;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -482,6 +472,16 @@ abstract class LdapBase implements LdapInterface, AuthInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver el puerto del servidor si está establecido
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function getServerPort()
|
||||
{
|
||||
return preg_match('/[\d\.]+:(\d+)/', $this->server, $port) ? $port[1] : 389;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener el servidor de LDAP a utilizar
|
||||
*
|
||||
|
||||
@@ -520,10 +520,6 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite
|
||||
throw new ItemException(__('Clave maestra actualizada') . '<br>' . __('Reinicie la sesión para cambiarla'));
|
||||
}
|
||||
|
||||
if (!UserPass::checkUserUpdateMPass(Session::getUserData()->getUserId())) {
|
||||
throw new ItemException(__('Clave maestra actualizada', false) . '<br>' . __('Reinicie la sesión para cambiarla', false));
|
||||
}
|
||||
|
||||
$key = CryptSession::getSessionKey();
|
||||
$securedKey = Crypt::unlockSecuredKey($AccountData->getAccountKey(), $key);
|
||||
$accountClearPass = Crypt::decrypt($AccountData->getAccountPass(), $securedKey, $key);
|
||||
|
||||
@@ -68,8 +68,8 @@ class MainController extends ControllerBase implements ActionsInterface
|
||||
* Constructor
|
||||
*
|
||||
* @param $template Template con instancia de plantilla
|
||||
* @param string $page El nombre de página para la clase del body
|
||||
* @param bool $initialize Si es una inicialización completa
|
||||
* @param string $page El nombre de página para la clase del body
|
||||
* @param bool $initialize Si es una inicialización completa
|
||||
*/
|
||||
public function __construct(Template $template = null, $page = '', $initialize = true)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,8 @@ use SP\Html\Html;
|
||||
*/
|
||||
class Request
|
||||
{
|
||||
private static $secureDirs = ['css', 'js'];
|
||||
|
||||
/**
|
||||
* Comprobar el método utilizado para enviar un formulario.
|
||||
*
|
||||
@@ -55,6 +57,48 @@ class Request
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver las cabeceras enviadas desde el cliente.
|
||||
*
|
||||
* @param string $header nombre de la cabecera a devolver
|
||||
* @return array|string
|
||||
*/
|
||||
public static function getRequestHeaders($header = '')
|
||||
{
|
||||
if (!empty($header)) {
|
||||
$header = strpos($header, 'HTTP_') === false ? 'HTTP_' . str_replace('-', '_', strtoupper($header)) : $header;
|
||||
|
||||
return isset($_SERVER[$header]) ? $_SERVER[$header] : '';
|
||||
}
|
||||
|
||||
return self::getApacheHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Función que sustituye a apache_request_headers
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function getApacheHeaders()
|
||||
{
|
||||
if (function_exists('\apache_request_headers')) {
|
||||
return apache_request_headers();
|
||||
}
|
||||
|
||||
$headers = [];
|
||||
|
||||
foreach ($_SERVER as $key => $value) {
|
||||
if (strpos($key, 'HTTP_') === 0) {
|
||||
$key = ucwords(strtolower(str_replace('_', '-', substr($key, 5))), '-');
|
||||
$headers[$key] = $value;
|
||||
} else {
|
||||
$headers[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analizar un valor encriptado y devolverlo desencriptado
|
||||
*
|
||||
@@ -142,48 +186,6 @@ class Request
|
||||
return (self::getRequestHeaders('Cache-Control') === 'max-age=0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver las cabeceras enviadas desde el cliente.
|
||||
*
|
||||
* @param string $header nombre de la cabecera a devolver
|
||||
* @return array|string
|
||||
*/
|
||||
public static function getRequestHeaders($header = '')
|
||||
{
|
||||
if (!empty($header)) {
|
||||
$header = strpos($header, 'HTTP_') === false ? 'HTTP_' . str_replace('-', '_', strtoupper($header)) : $header;
|
||||
|
||||
return isset($_SERVER[$header]) ? $_SERVER[$header] : '';
|
||||
}
|
||||
|
||||
return self::getApacheHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Función que sustituye a apache_request_headers
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function getApacheHeaders()
|
||||
{
|
||||
if (function_exists('\apache_request_headers')) {
|
||||
return apache_request_headers();
|
||||
}
|
||||
|
||||
$headers = [];
|
||||
|
||||
foreach ($_SERVER as $key => $value) {
|
||||
if (strpos($key, 'HTTP_') === 0) {
|
||||
$key = ucwords(strtolower(str_replace('_', '-', substr($key, 5))), '-');
|
||||
$headers[$key] = $value;
|
||||
} else {
|
||||
$headers[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comprobar si existen parámetros pasados por POST para enviarlos por GET
|
||||
*/
|
||||
@@ -218,22 +220,26 @@ class Request
|
||||
/**
|
||||
* Devolver una ruta segura para
|
||||
*
|
||||
* @param $path
|
||||
* @param null $base
|
||||
* @param $path
|
||||
* @param string $base
|
||||
* @return string
|
||||
*/
|
||||
public static function getSecureAppPath($path, $base = null)
|
||||
{
|
||||
if ($base === null) {
|
||||
$base = Init::$SERVERROOT;
|
||||
} elseif (!in_array(basename($base), self::$secureDirs, true)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$realPath = realpath($base . DIRECTORY_SEPARATOR . $path);
|
||||
|
||||
if ($realPath === false || strpos($realPath, $base) !== 0) {
|
||||
if ($realPath === false
|
||||
|| strpos($realPath, $base) !== 0
|
||||
) {
|
||||
return '';
|
||||
} else {
|
||||
return $realPath;
|
||||
}
|
||||
|
||||
return $realPath;
|
||||
}
|
||||
}
|
||||
@@ -407,8 +407,8 @@ class Util
|
||||
*/
|
||||
public static function getVersion($retBuild = false, $normalized = false)
|
||||
{
|
||||
$build = 17042601;
|
||||
$version = [2, 2, 0];
|
||||
$build = 17040401;
|
||||
$version = [2, 1, 5];
|
||||
|
||||
if ($normalized === true) {
|
||||
return [implode('', $version), $build];
|
||||
|
||||
Reference in New Issue
Block a user