Compare commits

...

9 Commits
6.1.0 ... 6.1.2

Author SHA1 Message Date
Yuri Kuznetsov
6a7b782309 v 2021-02-01 11:48:33 +02:00
Yuri Kuznetsov
9d080d7dca fix kanban order 2021-01-30 17:59:08 +02:00
Yuri Kuznetsov
2582dfe3c4 v 2021-01-29 12:29:47 +02:00
Yuri Kuznetsov
295411a5d2 fix auth token 2021-01-29 11:31:51 +02:00
Yuri Kuznetsov
453589de92 fix popup notification 2021-01-28 14:06:22 +02:00
Yuri Kuznetsov
f42c33d77a username validation 2021-01-27 12:27:33 +02:00
Yuri Kuznetsov
0d202499bc fix 2021-01-26 20:53:35 +02:00
Yuri Kuznetsov
be6896f34c fix log loader 2021-01-26 18:38:43 +02:00
Yuri Kuznetsov
e5a3a0637d fix deprecated 2021-01-26 17:02:01 +02:00
10 changed files with 58 additions and 16 deletions

View File

@@ -30,7 +30,6 @@
namespace Espo\Core\Authentication;
use Espo\Core\Exceptions\{
Error,
Forbidden,
ServiceUnavailable,
};
@@ -39,7 +38,7 @@ use Espo\Entities\{
Portal,
User,
AuthLogRecord,
AuthToken,
AuthToken as AuthTokenEntity,
};
use Espo\Core\Authentication\{
@@ -48,6 +47,7 @@ use Espo\Core\Authentication\{
TwoFactor\Factory as TwoFAFactory,
AuthToken\AuthTokenManager,
AuthToken\AuthTokenData,
AuthToken\AuthToken,
};
use Espo\Core\{
@@ -59,7 +59,6 @@ use Espo\Core\{
Api\Request,
};
use StdClass;
use DateTime;
/**
@@ -136,7 +135,7 @@ class Authentication
* @return Result if success or second step required. NULL if failed.
*/
public function login(
?string $username, ?string $password = null, Request $request, ?string $authenticationMethod = null
?string $username, ?string $password, Request $request, ?string $authenticationMethod = null
) : ?Result {
$isByTokenOnly = false;
@@ -474,13 +473,14 @@ class Authentication
$this->setSecretInCookie($authToken->getSecret());
}
if ($this->config->get('authTokenPreventConcurrent')) {
if ($this->config->get('authTokenPreventConcurrent') && $authToken instanceof AuthTokenEntity) {
$concurrentAuthTokenList = $this->entityManager
->getRepository('AuthToken')
->select(['id'])
->where([
'userId' => $user->id,
'isActive' => true,
'id!=' => $authToken->get('id'),
])
->find();

View File

@@ -36,7 +36,6 @@ use Monolog\{
};
use ReflectionClass;
use ReflectionMethod;
use RuntimeException;
class DefaultHandlerLoader

View File

@@ -31,6 +31,7 @@ namespace Espo\Core\Log;
use Espo\Core\{
Log\Handler\EspoRotatingFileHandler,
Utils\Config,
};
use Monolog\{
@@ -40,11 +41,18 @@ use Monolog\{
class EspoRotatingFileHandlerLoader implements HandlerLoader
{
private $config;
public function __construct(Config $config)
{
$this->config = $config;
}
public function load(array $params) : HandlerInterface
{
$filename = $params['filename'] ?? 'data/logs/espo.log';
$level = $params['level'] ?? Logger::NOTICE;
return new EspoRotatingFileHandler($filename, 0, $level);
return new EspoRotatingFileHandler($this->config, $filename, 0, $level);
}
}

View File

@@ -13,7 +13,7 @@
},
"userId": {
"type": "varchar",
"maxLength": 11
"maxLength": 24
}
},
"links": {

View File

@@ -46,6 +46,8 @@ use Espo\{
class TcpdfCollectionPrinter implements CollectionPrinter
{
protected $entityProcessor;
protected $config;
protected $htmlizerFactory;

View File

@@ -45,6 +45,8 @@ use Espo\{
class TcpdfEntityPrinter implements EntityPrinter
{
protected $entityProcessor;
protected $config;
protected $htmlizerFactory;

View File

@@ -227,7 +227,7 @@ define('views/notification/badge', 'view', function (Dep) {
.then(
function (result) {
for (const type in result) {
const list = result[name];
const list = result[type];
list.forEach(function (item) {
this.showPopupNotification(type, item);

View File

@@ -26,16 +26,22 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/fields/user-name', 'views/fields/varchar', function (Dep) {
define('views/user/fields/user-name', 'views/fields/varchar', function (Dep) {
return Dep.extend({
setup: function () {
Dep.prototype.setup.call(this);
this.validations.push('userName');
},
afterRender: function () {
Dep.prototype.afterRender.call(this);
var userNameRegularExpression = this.getConfig().get('userNameRegularExpression') || '[^a-z0-9\-@_\.\s]';
var userNameRegularExpression = this.getUserNameRegularExpression();
if (this.mode == 'edit') {
if (this.mode === 'edit') {
this.$element.on('change', function () {
var value = this.$element.val();
var re = new RegExp(userNameRegularExpression, 'gi');
@@ -44,8 +50,33 @@ Espo.define('views/user/fields/user-name', 'views/fields/varchar', function (Dep
this.trigger('change');
}.bind(this));
}
}
},
getUserNameRegularExpression: function () {
return this.getConfig().get('userNameRegularExpression') || '[^a-z0-9\-@_\.\s]';
},
validateUserName: function () {
var value = this.model.get(this.name);
if (!value) {
return;
}
var userNameRegularExpression = this.getUserNameRegularExpression();
var re = new RegExp(userNameRegularExpression, 'gi');
if (!re.test(value)) {
return;
}
var msg = this.translate('fieldInvalid', 'messages').replace('{field}', this.getLabelText());
this.showValidationMessage(msg);
return true;
},
});
});

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "espocrm",
"version": "6.1.0",
"version": "6.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "espocrm",
"version": "6.1.0",
"version": "6.1.2",
"description": "",
"main": "index.php",
"repository": {