mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-03 07:04:07 +01:00
* [MOD] Improve file handling
* [MOD] Remove email pattern restriction when setting mail auth. Related #778. Thanks to @matthgyver for the feedback. * [MOD] Removed unused config attribute Signed-off-by: nuxsmin <nuxsmin@syspass.org>
This commit is contained in:
@@ -37,6 +37,7 @@ use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Mvc\Controller\CrudControllerInterface;
|
||||
use SP\Services\Account\AccountFileService;
|
||||
use SP\Services\Account\AccountService;
|
||||
use SP\Storage\File\FileHandler;
|
||||
use SP\Util\ErrorUtil;
|
||||
use SP\Util\FileUtil;
|
||||
use SP\Util\Util;
|
||||
@@ -166,6 +167,8 @@ final class AccountFileController extends ControllerBase implements CrudControll
|
||||
throw new SPException(__u('No hay extensiones permitidas'), SPException::ERROR);
|
||||
}
|
||||
|
||||
$fileHandler = new FileHandler($file['tmp_name']);
|
||||
|
||||
$fileData = new FileData();
|
||||
$fileData->setAccountId($accountId);
|
||||
$fileData->setName(Html::sanitize($file['name']));
|
||||
@@ -210,8 +213,7 @@ final class AccountFileController extends ControllerBase implements CrudControll
|
||||
);
|
||||
}
|
||||
|
||||
// Leemos el archivo a una variable
|
||||
$fileData->setContent(file_get_contents($file['tmp_name']));
|
||||
$fileData->setContent($fileHandler->readToString());
|
||||
|
||||
if ($fileData->getContent() === false) {
|
||||
throw new SPException(__u('Error interno al leer el archivo'));
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
</td>
|
||||
<td class="valField">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input id="mail_user" name="mail_user" type="email"
|
||||
<input id="mail_user" name="mail_user" type="text"
|
||||
class="mdl-textfield__input mdl-color-text--indigo-400"
|
||||
maxlength="50" value="<?php echo $configData->getMailUser(); ?>"/>
|
||||
<label class="mdl-textfield__label" for="mail_user"><?php echo __('Usuario'); ?></label>
|
||||
|
||||
@@ -205,10 +205,6 @@ final class ConfigData implements JsonSerializable
|
||||
* @var string
|
||||
*/
|
||||
private $ldapServer;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $ldapUserattr;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
@@ -1249,26 +1245,6 @@ final class ConfigData implements JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLdapUserattr()
|
||||
{
|
||||
return $this->ldapUserattr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ldapUserattr
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLdapUserattr($ldapUserattr)
|
||||
{
|
||||
$this->ldapUserattr = $ldapUserattr;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user