diff --git a/app/modules/web/Controllers/AccountController.php b/app/modules/web/Controllers/AccountController.php index f254ed5e..e7378eba 100644 --- a/app/modules/web/Controllers/AccountController.php +++ b/app/modules/web/Controllers/AccountController.php @@ -1054,6 +1054,9 @@ final class AccountController extends ControllerBase implements CrudControllerIn $accountDetails = $this->accountService->getById($id)->getAccountVData(); + $deepLink = new Uri(Bootstrap::$WEBURI . Bootstrap::$SUBURI); + $deepLink->addParam('r', Acl::getActionRoute(ActionsInterface::ACCOUNT_VIEW) . '/' . $id); + $this->eventDispatcher->notifyEvent('request.account', new Event($this, EventMessage::factory() ->addDescription(__u('Request')) @@ -1061,10 +1064,10 @@ final class AccountController extends ControllerBase implements CrudControllerIn ->addDetail(__u('Account'), $accountDetails->getName()) ->addDetail(__u('Client'), $accountDetails->getClientName()) ->addDetail(__u('Description'), $description) + ->addDetail(__u('Link'), $deepLink->getUriSigned($this->configData->getPasswordSalt())) ->addExtra('accountId', $id) ->addExtra('whoId', $this->userData->getId()) - ->addExtra('userId', $accountDetails->userId) - ->addExtra('userId', $accountDetails->userEditId)) + ->setExtra('userId', [$accountDetails->userId, $accountDetails->userEditId])) ); return $this->returnJsonResponseData( diff --git a/app/modules/web/Controllers/ConfigAccountController.php b/app/modules/web/Controllers/ConfigAccountController.php index 471469b5..1ab100f2 100644 --- a/app/modules/web/Controllers/ConfigAccountController.php +++ b/app/modules/web/Controllers/ConfigAccountController.php @@ -105,9 +105,16 @@ final class ConfigAccountController extends SimpleControllerBase } - return $this->saveConfig($configData, $this->config, function () use ($eventMessage) { - $this->eventDispatcher->notifyEvent('save.config.account', new Event($this, $eventMessage)); - }); + return $this->saveConfig( + $configData, + $this->config, + function () use ($eventMessage) { + $this->eventDispatcher->notifyEvent( + 'save.config.account', + new Event($this, $eventMessage) + ); + } + ); } /** diff --git a/app/modules/web/Controllers/ConfigEncryptionController.php b/app/modules/web/Controllers/ConfigEncryptionController.php index 547d70d5..b71008e9 100644 --- a/app/modules/web/Controllers/ConfigEncryptionController.php +++ b/app/modules/web/Controllers/ConfigEncryptionController.php @@ -144,7 +144,11 @@ final class ConfigEncryptionController extends SimpleControllerBase } } - return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS_STICKY, __u('Master password updated'), [__u('Please, restart the session for update it')]); + return $this->returnJsonResponse( + JsonResponse::JSON_SUCCESS_STICKY, + __u('Master password updated'), + [__u('Please, restart the session for update it')] + ); } /** @@ -196,13 +200,21 @@ final class ConfigEncryptionController extends SimpleControllerBase try { $temporaryMasterPassService->sendByEmailForGroup($groupId, $key); - return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Temporary password generated'), [__u('Email sent')]); + return $this->returnJsonResponse( + JsonResponse::JSON_SUCCESS, + __u('Temporary password generated'), + [__u('Email sent')] + ); } catch (\Exception $e) { processException($e); $this->eventDispatcher->notifyEvent('exception', new Event($e)); - return $this->returnJsonResponse(JsonResponse::JSON_WARNING, __u('Temporary password generated'), [__u('Error while sending the email')]); + return $this->returnJsonResponse( + JsonResponse::JSON_WARNING, + __u('Temporary password generated'), + [__u('Error while sending the email')] + ); } } diff --git a/app/modules/web/Controllers/ConfigGeneralController.php b/app/modules/web/Controllers/ConfigGeneralController.php index 20f4b8a0..541f5bab 100644 --- a/app/modules/web/Controllers/ConfigGeneralController.php +++ b/app/modules/web/Controllers/ConfigGeneralController.php @@ -166,9 +166,16 @@ final class ConfigGeneralController extends SimpleControllerBase $eventMessage->addDescription(__u('Auth Basic disabled')); } - return $this->saveConfig($configData, $this->config, function () use ($eventMessage) { - $this->eventDispatcher->notifyEvent('save.config.general', new Event($this, $eventMessage)); - }); + return $this->saveConfig( + $configData, + $this->config, + function () use ($eventMessage) { + $this->eventDispatcher->notifyEvent( + 'save.config.general', + new Event($this, $eventMessage) + ); + } + ); } /** diff --git a/app/modules/web/Controllers/ConfigImportController.php b/app/modules/web/Controllers/ConfigImportController.php index 274ff2e7..20dbcc10 100644 --- a/app/modules/web/Controllers/ConfigImportController.php +++ b/app/modules/web/Controllers/ConfigImportController.php @@ -79,10 +79,18 @@ final class ConfigImportController extends SimpleControllerBase ); if ($counter > 0) { - return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Import finished'), [__u('Please check out the event log for more details')]); + return $this->returnJsonResponse( + JsonResponse::JSON_SUCCESS, + __u('Import finished'), + [__u('Please check out the event log for more details')] + ); } - return $this->returnJsonResponse(JsonResponse::JSON_WARNING, __u('No accounts were imported'), [__u('Please check out the event log for more details')]); + return $this->returnJsonResponse( + JsonResponse::JSON_WARNING, + __u('No accounts were imported'), + [__u('Please check out the event log for more details')] + ); } catch (\Exception $e) { processException($e); diff --git a/app/modules/web/Controllers/ConfigMailController.php b/app/modules/web/Controllers/ConfigMailController.php index 62ece0ba..304a484a 100644 --- a/app/modules/web/Controllers/ConfigMailController.php +++ b/app/modules/web/Controllers/ConfigMailController.php @@ -68,7 +68,9 @@ final class ConfigMailController extends SimpleControllerBase $mailRecipients = ConfigUtil::mailAddressesAdapter($this->request->analyzeString('mail_recipients')); // Valores para la configuración del Correo - if ($mailEnabled && (!$mailServer || !$mailFrom || count($mailRecipients) === 0)) { + if ($mailEnabled + && (empty($mailServer) || empty($mailFrom) || empty($mailRecipients)) + ) { return $this->returnJsonResponse(JsonResponse::JSON_ERROR, __u('Missing Mail parameters')); } @@ -106,9 +108,16 @@ final class ConfigMailController extends SimpleControllerBase return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('No changes')); } - return $this->saveConfig($configData, $this->config, function () use ($eventMessage) { - $this->eventDispatcher->notifyEvent('save.config.mail', new Event($this, $eventMessage)); - }); + return $this->saveConfig( + $configData, + $this->config, + function () use ($eventMessage) { + $this->eventDispatcher->notifyEvent( + 'save.config.mail', + new Event($this, $eventMessage) + ); + } + ); } /** @@ -125,11 +134,11 @@ final class ConfigMailController extends SimpleControllerBase $mailParams->port = $this->request->analyzeInt('mail_port', 25); $mailParams->security = $this->request->analyzeString('mail_security'); $mailParams->from = $this->request->analyzeEmail('mail_from'); - $mailParams->mailAuthenabled = $this->request->analyzeBool('mail_authenabled', false); + $mailParams->mailAuthenabled = $this->request->analyzeBool('mail_auth_enabled', false); $mailRecipients = ConfigUtil::mailAddressesAdapter($this->request->analyzeString('mail_recipients')); // Valores para la configuración del Correo - if (!$mailParams->server || empty($mailParams->from) || empty($mailRecipients)) { + if (empty($mailParams->server) || empty($mailParams->from) || empty($mailRecipients)) { return $this->returnJsonResponse(JsonResponse::JSON_ERROR, __u('Missing Mail parameters')); } @@ -164,7 +173,8 @@ final class ConfigMailController extends SimpleControllerBase /** * @return bool */ - protected function initialize() + protected + function initialize() { try { $this->checks(); diff --git a/app/modules/web/themes/material-blue/views/config/mail.inc b/app/modules/web/themes/material-blue/views/config/mail.inc index 401ce0a1..6f48d4c6 100644 --- a/app/modules/web/themes/material-blue/views/config/mail.inc +++ b/app/modules/web/themes/material-blue/views/config/mail.inc @@ -145,7 +145,7 @@