Verified Commit 311e10bb authored by Thierry Fenasse's avatar Thierry Fenasse
Browse files
parents 53551d55 60167b11
......@@ -10,7 +10,7 @@ end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
indent_size = 2
# 2 space indentation
[*.{yaml,.yml}]
......
# v1.10.28
## 01/24/2022
1. [](#bugfix)
* Clean file names before displaying errors/metadata modals
* Recompiled JS for production [#2225](https://github.com/getgrav/grav-plugin-admin/issues/2225)
# v1.10.27
## 01/12/2022
1. [](#new)
* Support for `YubiKey OTP` 2-Factor authenticator
* New `elements` container field that shows/hides children fields based on boolean trigger value
* Requires Grav `v1.7.27` and Login `v3.6.2`
2. [](#improved)
* Added new asset language strings
# v1.10.26.1
## 01/03/2022
3. [](#bugfix)
* Fixed an issue with missing files reference by cached autoloader
# v1.10.26
## 01/03/2022
2. [](#improved)
* Updated SCSS compiler to v1.9 and other vendor libraries
* Fixed various deprecation warnings
* Localized dialog buttons and icons [#2207](https://github.com/getgrav/grav-plugin-admin/pull/2207)
* Updated copyright year
# v1.10.25
## 11/16/2021
3. [](#bugfix)
* Fixed unescaped messages in JSON responses
# v1.10.24
## 10/26/2021
1. [](#new)
* Require **Grav 1.7.24**
2. [](#improved)
* Use new `Http\Response` rather than deprecated `GPM\Response`
3. [](#bugfix)
* Fixed an issue with invalid HTML throwing errors on HTML security scanning
* Clear cache when installing plugins
# v1.10.23
## 09/29/2021
......
......@@ -452,11 +452,11 @@ class AdminPlugin extends Plugin
$legacyController = true;
}
/** @var UserInterface $user */
$user = $this->grav['user'];
// Replace page service with admin.
if (empty($this->grav['page'])) {
/** @var UserInterface $user */
$user = $this->grav['user'];
$this->grav['page'] = function () use ($user) {
$page = new Page();
......
name: Admin Panel
slug: admin
type: plugin
version: 1.10.23
version: 1.10.28
description: Adds an advanced administration panel to manage your site
icon: empire
author:
......@@ -15,9 +15,9 @@ docs: https://github.com/getgrav/grav-plugin-admin/blob/develop/README.md
license: MIT
dependencies:
- { name: grav, version: '>=1.7.21' }
- { name: grav, version: '>=1.7.28' }
- { name: form, version: '>=5.1.0' }
- { name: login, version: '>=3.5.0' }
- { name: login, version: '>=3.6.2' }
- { name: email, version: '>=3.1.0' }
- { name: flex-objects, version: '>=1.1.0' }
......
......@@ -10,9 +10,9 @@ use Grav\Common\File\CompiledYamlFile;
use Grav\Common\Flex\Types\Users\UserObject;
use Grav\Common\GPM\GPM;
use Grav\Common\GPM\Licenses;
use Grav\Common\GPM\Response;
use Grav\Common\Grav;
use Grav\Common\Helpers\YamlLinter;
use Grav\Common\HTTP\Response;
use Grav\Common\Language\Language;
use Grav\Common\Language\LanguageCodes;
use Grav\Common\Page\Collection;
......@@ -2407,7 +2407,7 @@ class Admin
/**
* Get changelog for a given GPM package based on slug
*
* @param null $slug
* @param string|null $slug
* @return array
*/
public function getChangelog($slug = null)
......
......@@ -271,7 +271,7 @@ class AdminBaseController
$this->admin->json_response = [
'status' => 'error',
'message' => sprintf($this->admin::translate('PLUGIN_ADMIN.FILEUPLOAD_UNABLE_TO_UPLOAD', null),
$filename, 'Bad filename')
htmlspecialchars($filename, ENT_QUOTES | ENT_HTML5, 'UTF-8'), 'Bad filename')
];
return false;
......@@ -291,7 +291,7 @@ class AdminBaseController
$this->admin->json_response = [
'status' => 'error',
'message' => sprintf($this->admin::translate('PLUGIN_ADMIN.FILEUPLOAD_PREVENT_SELF', null),
$settings->destination)
htmlspecialchars($settings->destination, ENT_QUOTES | ENT_HTML5, 'UTF-8'))
];
return false;
......@@ -302,7 +302,8 @@ class AdminBaseController
$this->admin->json_response = [
'status' => 'error',
'message' => sprintf($this->admin::translate('PLUGIN_ADMIN.FILEUPLOAD_UNABLE_TO_UPLOAD', null),
$filename, $this->upload_errors[$upload->file->error])
htmlspecialchars($filename, ENT_QUOTES | ENT_HTML5, 'UTF-8'),
$this->upload_errors[$upload->file->error])
];
return false;
......@@ -340,7 +341,7 @@ class AdminBaseController
if ($isMime) {
$match = preg_match('#' . $find . '$#', $mime);
if (!$match) {
$errors[] = 'The MIME type "' . $mime . '" for the file "' . $filename . '" is not an accepted.';
$errors[] = htmlspecialchars('The MIME type "' . $mime . '" for the file "' . $filename . '" is not an accepted.', ENT_QUOTES | ENT_HTML5, 'UTF-8');
} else {
$accepted = true;
break;
......@@ -348,7 +349,7 @@ class AdminBaseController
} else {
$match = preg_match('#' . $find . '$#', $filename);
if (!$match) {
$errors[] = 'The File Extension for the file "' . $filename . '" is not an accepted.';
$errors[] = htmlspecialchars('The File Extension for the file "' . $filename . '" is not an accepted.', ENT_QUOTES | ENT_HTML5, 'UTF-8');
} else {
$accepted = true;
break;
......@@ -379,8 +380,11 @@ class AdminBaseController
if (!move_uploaded_file($tmp_file, $tmp)) {
$this->admin->json_response = [
'status' => 'error',
'message' => sprintf($this->admin::translate('PLUGIN_ADMIN.FILEUPLOAD_UNABLE_TO_MOVE', null), '',
$tmp)
'message' => sprintf(
$this->admin::translate('PLUGIN_ADMIN.FILEUPLOAD_UNABLE_TO_MOVE', null),
'',
htmlspecialchars($tmp, ENT_QUOTES | ENT_HTML5, 'UTF-8')
)
];
return false;
......
......@@ -288,7 +288,7 @@ class AdminController extends AdminBaseController
$debugger = $this->grav['debugger'];
$debugger->addException($e);
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
$this->admin->json_response = ['status' => 'error', 'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5, 'UTF-8')];
return false;
}
......@@ -407,7 +407,7 @@ class AdminController extends AdminBaseController
$debugger = $this->grav['debugger'];
$debugger->addException($e);
$json_response = ['status' => 'error', 'message' => $e->getMessage()];
$json_response = ['status' => 'error', 'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5, 'UTF-8')];
}
$this->sendJsonResponse($json_response);
......@@ -490,7 +490,7 @@ class AdminController extends AdminBaseController
$debugger = $this->grav['debugger'];
$debugger->addException($e);
$json_response = ['status' => 'error', 'message' => $e->getMessage()];
$json_response = ['status' => 'error', 'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5, 'UTF-8')];
}
$this->sendJsonResponse($json_response);
......@@ -540,7 +540,7 @@ class AdminController extends AdminBaseController
$this->admin->json_response = [
'status' => 'error',
'message' => $this->admin::translate('PLUGIN_ADMIN.AN_ERROR_OCCURRED') . '. ' . $e->getMessage()
'message' => $this->admin::translate('PLUGIN_ADMIN.AN_ERROR_OCCURRED') . '. ' . htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5, 'UTF-8')
];
return true;
......@@ -917,7 +917,7 @@ class AdminController extends AdminBaseController
$debugger = $this->grav['debugger'];
$debugger->addException($e);
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
$this->admin->json_response = ['status' => 'error', 'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5, 'UTF-8')];
return false;
}
......@@ -961,7 +961,7 @@ class AdminController extends AdminBaseController
$debugger = $this->grav['debugger'];
$debugger->addException($e);
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
$this->admin->json_response = ['status' => 'error', 'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5, 'UTF-8')];
return false;
}
......@@ -1004,7 +1004,7 @@ class AdminController extends AdminBaseController
$debugger = $this->grav['debugger'];
$debugger->addException($e);
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
$this->admin->json_response = ['status' => 'error', 'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5, 'UTF-8')];
return false;
}
......@@ -1059,7 +1059,7 @@ class AdminController extends AdminBaseController
$msg = Utils::contains($msg, '401 Unauthorized') ? "ERROR: License key for this resource is invalid." : $msg;
$msg = Utils::contains($msg, '404 Not Found') ? "ERROR: Resource not found" : $msg;
$this->admin->json_response = ['status' => 'error', 'message' => $msg];
$this->admin->json_response = ['status' => 'error', 'message' => htmlspecialchars($msg, ENT_QUOTES | ENT_HTML5, 'UTF-8')];
return false;
}
......@@ -1133,7 +1133,7 @@ class AdminController extends AdminBaseController
$debugger = $this->grav['debugger'];
$debugger->addException($e);
$json_response = ['status' => 'error', 'message' => $e->getMessage()];
$json_response = ['status' => 'error', 'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5, 'UTF-8')];
$this->sendJsonResponse($json_response, 200);
}
......@@ -2068,7 +2068,7 @@ class AdminController extends AdminBaseController
$debugger = $this->grav['debugger'];
$debugger->addException($e);
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
$this->admin->json_response = ['status' => 'error', 'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5, 'UTF-8')];
return false;
}
......@@ -2225,7 +2225,7 @@ class AdminController extends AdminBaseController
$this->admin->json_response = [
'status' => 'error',
'message' => sprintf($this->admin::translate('PLUGIN_ADMIN.FILEUPLOAD_UNABLE_TO_UPLOAD'),
$filename, 'Bad filename')
htmlspecialchars($filename, ENT_QUOTES | ENT_HTML5, 'UTF-8'), 'Bad filename')
];
return false;
......@@ -2453,7 +2453,7 @@ class AdminController extends AdminBaseController
if (!$result) {
$this->admin->json_response = [
'status' => 'error',
'message' => $this->admin::translate('PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED') . ': ' . $filename
'message' => $this->admin::translate('PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED') . ': ' . htmlspecialchars($filename, ENT_QUOTES | ENT_HTML5, 'UTF-8')
];
return false;
......@@ -2474,7 +2474,7 @@ class AdminController extends AdminBaseController
if (!$result) {
$this->admin->json_response = [
'status' => 'error',
'message' => $this->admin::translate('PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED') . ': ' . $filename
'message' => $this->admin::translate('PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED') . ': ' . htmlspecialchars($filename, ENT_QUOTES | ENT_HTML5, 'UTF-8')
];
return false;
......@@ -2489,7 +2489,7 @@ class AdminController extends AdminBaseController
if (!$found) {
$this->admin->json_response = [
'status' => 'error',
'message' => $this->admin::translate('PLUGIN_ADMIN.FILE_NOT_FOUND') . ': ' . $filename
'message' => $this->admin::translate('PLUGIN_ADMIN.FILE_NOT_FOUND') . ': ' . htmlspecialchars($filename, ENT_QUOTES | ENT_HTML5, 'UTF-8')
];
return false;
......@@ -2500,7 +2500,7 @@ class AdminController extends AdminBaseController
$this->admin->json_response = [
'status' => 'success',
'message' => $this->admin::translate('PLUGIN_ADMIN.FILE_DELETED') . ': ' . $filename
'message' => $this->admin::translate('PLUGIN_ADMIN.FILE_DELETED') . ': ' . htmlspecialchars($filename, ENT_QUOTES | ENT_HTML5, 'UTF-8')
];
return true;
......
......@@ -3,7 +3,7 @@
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
......
......@@ -292,7 +292,7 @@ abstract class AbstractController implements RequestHandlerInterface
$response = [
'code' => $code,
'status' => 'error',
'message' => $message
'message' => htmlspecialchars($message, ENT_QUOTES | ENT_HTML5, 'UTF-8')
];
$accept = $this->getAccept(['application/json', 'text/html']);
......
......@@ -3,7 +3,7 @@
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
......
......@@ -3,7 +3,7 @@
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
......@@ -275,11 +275,17 @@ class LoginController extends AdminController
$twoFa = null;
}
$code = $data['2fa_code'] ?? null;
$secret = $user->twofa_secret ?? null;
$code = $data['2fa_code'] ?? '';
$secret = $user->twofa_secret ?? '';
$twofa_valid = $twoFa->verifyCode($secret, $code);
$yubikey_otp = $data['yubikey_otp'] ?? '';
$yubikey_id = $user->yubikey_id ?? '';
$yubikey_valid = $twoFa->verifyYubikeyOTP($yubikey_id, $yubikey_otp);
$redirect = (string)$this->getRequest()->getUri();
if (null === $twoFa || !$user->authenticated || !$code || !$secret || !$twoFa->verifyCode($secret, $code)) {
if (null === $twoFa || !$user->authenticated || (!$twofa_valid && !$yubikey_valid) ) {
Admin::DEBUG && Admin::addDebugMessage('Admin login: 2FA check failed, log out!');
// Failed 2FA auth, logout and redirect to the current page.
......
......@@ -7,8 +7,8 @@ use Grav\Common\Grav;
use Grav\Common\GPM\GPM as GravGPM;
use Grav\Common\GPM\Licenses;
use Grav\Common\GPM\Installer;
use Grav\Common\GPM\Response;
use Grav\Common\GPM\Upgrader;
use Grav\Common\HTTP\Response;
use Grav\Common\Filesystem\Folder;
use Grav\Common\GPM\Common\Package;
......@@ -118,6 +118,8 @@ class Gpm
}
}
Cache::clearCache();
return $messages ?: true;
}
......@@ -190,6 +192,8 @@ class Gpm
}
}
Cache::clearCache();
return true;
}
......@@ -277,6 +281,7 @@ class Gpm
}
Folder::delete($tmp_zip);
Cache::clearCache();
return true;
}
......
......@@ -3,7 +3,7 @@
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
......
......@@ -23,7 +23,8 @@
"php": "^7.3.6 || ^8.0",
"ext-json": "*",
"p3k/picofeed": "@stable",
"scssphp/scssphp": "^1.7"
"scssphp/scssphp": "^1.7",
"laminas/laminas-zendframework-bridge": "^1.4"
},
"require-dev": {
"codeception/codeception": "^2.4",
......
This diff is collapsed.
......@@ -394,6 +394,7 @@ PLUGIN_ADMIN:
AUTOESCAPE_VARIABLES: "Autoescape variables"
AUTOESCAPE_VARIABLES_HELP: "Autoescapes all variables. This will break your site most likely"
ASSETS: "Assets"
CSS_ASSETS: "CSS Assets"
CSS_PIPELINE: "CSS pipeline"
CSS_PIPELINE_HELP: "The CSS pipeline is the unification of multiple CSS resources into one file"
CSS_PIPELINE_INCLUDE_EXTERNALS: "Include externals in CSS pipeline"
......@@ -406,12 +407,21 @@ PLUGIN_ADMIN:
CSS_MINIFY_WINDOWS_OVERRIDE_HELP: "Minify Override for Windows platforms. False by default due to ThreadStackSize"
CSS_REWRITE: "CSS rewrite"
CSS_REWRITE_HELP: "Rewrite any CSS relative URLs during pipelining"
JS_ASSETS: "JavaScript Assets"
JAVASCRIPT_PIPELINE: "JavaScript pipeline"
JAVASCRIPT_PIPELINE_HELP: "The JS pipeline is the unification of multiple JS resources into one file"
JAVASCRIPT_PIPELINE_INCLUDE_EXTERNALS: "Include externals in JS pipeline"
JAVASCRIPT_PIPELINE_INCLUDE_EXTERNALS_HELP: "External URLs sometimes have relative file references and shouldn't be pipelined"
JAVASCRIPT_PIPELINE_BEFORE_EXCLUDES: "JS pipeline render first"
JAVASCRIPT_PIPELINE_BEFORE_EXCLUDES_HELP: "Render the JS pipeline before any other JS references that are not included"
JS_MODULE_ASSETS: "JavaScript Module Assets"
JAVASCRIPT_MODULE_PIPELINE: "JavaScript Module pipeline"
JAVASCRIPT_MODULE_PIPELINE_HELP: "The JS Module pipeline is the unification of multiple JS resources into one file"
JAVASCRIPT_MODULE_PIPELINE_INCLUDE_EXTERNALS: "Include externals in JS Module pipeline"
JAVASCRIPT_MODULE_PIPELINE_INCLUDE_EXTERNALS_HELP: "External URLs sometimes have relative file references and shouldn't be pipelined"
JAVASCRIPT_MODULE_PIPELINE_BEFORE_EXCLUDES: "JS Module pipeline render first"
JAVASCRIPT_MODULE_PIPELINE_BEFORE_EXCLUDES_HELP: "Render the JS pipeline before any other JS references that are not included"
GENERAL_CONFIG: "General Asset Configuration"
JAVASCRIPT_MINIFY: "JavaScript minify"
JAVASCRIPT_MINIFY_HELP: "Minify the JS during pipelining"
ENABLED_TIMESTAMPS_ON_ASSETS: "Enable timestamps on assets"
......@@ -551,6 +561,8 @@ PLUGIN_ADMIN:
COPY_PAGE: "Copy Page"
PROXY_URL: "Proxy URL"
PROXY_URL_HELP: "Enter the proxy HOST or IP and PORT"
PROXY_CERT: "Proxy Certificate Path"
PROXY_CERT_HELP: "Local path to folder containing proxy certificate pem file"
NOTHING_TO_SAVE: "Nothing to Save"
FILE_ERROR_ADD: "An error occurred while trying to add the file"
FILE_ERROR_UPLOAD: "An error occurred while trying to upload the file"
......@@ -578,12 +590,20 @@ PLUGIN_ADMIN:
UPDATING_PACKAGES: "Updating package(s).."
PACKAGES_SUCCESSFULLY_UPDATED: "Package(s) successfully updated."
UPDATING: "Updating"
GPM_SECTION: "GPM Section"
GPM_RELEASES: "GPM Releases"
GPM_RELEASES_HELP: "Choose 'Testing' to install beta or testing versions"
GPM_METHOD: "Remote Fetch Method"
GPM_METHOD_HELP: "When set to Auto, Grav will determine if fopen is available and use it, otherwise fall back to cURL. To force the use of one or the other switch the setting."
GPM_VERIFY_PEER: "Remote Verify Peer (SSL)"
GPM_VERIFY_PEER_HELP: "Some providers seems to fail verifying getgrav.org SSL certificate, causing GPM to not work. If this is the case for you, turning off this setting might help"
HTTP_SECTION: "HTTP Section"
SSL_ENABLE_PROXY: "Enable Proxy Server"
SSL_VERIFY_PEER: "Remote Verify Peer"
SSL_VERIFY_PEER_HELP: "Some may fail verifying SSL certificates"
SSL_VERIFY_HOST: "Remote Verify Host"
SSL_VERIFY_HOST_HELP: "Some may fail verifying SSL certificates"
HTTP_CONNECTIONS: "HTTP Connections"
HTTP_CONNECTIONS_HELP: "The number of concurrent HTTP connections during multiplexed requests"
MISC_SECTION: "Miscellaneous Section"
AUTO: "Auto"
FOPEN: "fopen"
CURL: "cURL"
......@@ -738,6 +758,9 @@ PLUGIN_ADMIN:
2FA_SECRET: "2FA Secret"
2FA_SECRET_HELP: "Scan this QR code into your [Authenticator App](https://learn.getgrav.org/admin-panel/2fa#apps). Also it's a good idea to backup the secret in a safe location, in case you need to reinstall your app. Check the [Grav docs](https://learn.getgrav.org/admin-panel/2fa) for more information "
2FA_REGENERATE: "Regenerate"
YUBIKEY_ID: "YubiKey ID"
YUBIKEY_OTP_INPUT: "YubiKey OTP"
YUBIKEY_HELP: "Insert your YubiKey into your computer and click the button to generate an OTP. The first 12 chars are your client ID and will be saved."
FORCE_LOWERCASE_URLS: "Force lowercase URLs"
FORCE_LOWERCASE_URLS_HELP: "By default Grav will set all slugs and routes to be lowercase. With this set to false, Uppercase slugs and routes can be used"
INTL_ENABLED: "Intl module integration"
......@@ -1112,3 +1135,5 @@ PLUGIN_ADMIN:
ENABLE: Enable
PLUGINS_MUST_BE_ENABLED: "Plugin must be enabled to configure"
ACTIVATION_REQUIRED: "Activation required to configure"
SESSION_SECURE_HTTPS: "Secure (HTTPS)"
SESSION_SECURE_HTTPS_HELP: "Set session secure on HTTPS but not on HTTP. Has no effect if you have above Secure setting set to true. Set to false if your site jumps between HTTP and HTTPS."
......@@ -37,4 +37,9 @@ forms:
id: twofa-code
autofocus: true
placeholder: PLUGIN_ADMIN.2FA_CODE_INPUT
description: or
yubikey_otp:
type: text
id: yubikey-otp
placeholder: PLUGIN_ADMIN.YUBIKEY_OTP_INPUT
---
......@@ -35,7 +35,6 @@
"generator-star-spacing": [2, { "before": true, "after": true }],
"guard-for-in": 0,
"handle-callback-err": [2, "^(err|error)$" ],
"indent": [2, 4, { "SwitchCase": 1 }],
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
"linebreak-style": 0,
"lines-around-comment": 0,
......
import $ from 'jquery';
$(document).on('change', '[data-grav-elements] select', (event) => {
const target = $(event.currentTarget);
const value = target.val();
const id = target.closest('[data-grav-elements]').data('gravElements');
$(`[id^="${id}_"]`).css('display', 'none');
$(`[id="${id}__${value}"]`).css('display', 'inherit');
});
......@@ -224,7 +224,7 @@ export default class FilesField {
file,
data: response,
mode: 'removeFile',
msg: `<p>${translations.PLUGIN_ADMIN.FILE_ERROR_UPLOAD} <strong>${file.name}</strong></p>
msg: `<p>${translations.PLUGIN_ADMIN.FILE_ERROR_UPLOAD} <strong>{{fileName}}</strong></p>
<pre>${response.message}</pre>`
});
}
......@@ -240,7 +240,7 @@ export default class FilesField {
file,
data,
mode: 'removeFile',
msg: `<p>${translations.PLUGIN_ADMIN.FILE_ERROR_ADD} <strong>${file.name}</strong></p>
msg: `<p>${translations.PLUGIN_ADMIN.FILE_ERROR_ADD} <strong>{{fileName}}</strong></p>
<pre>${data.message}</pre>`
});
}
......@@ -325,7 +325,9 @@ export default class FilesField {
}
let modal = $('[data-remodal-id="generic"]');
modal.find('.error-content').html(msg);
const cleanName = file.name.replace('<', '&lt;').replace('>', '&gt;');
modal.find('.error-content').html(msg.replace('{{fileName}}', cleanName));
$.remodal.lookup[modal.data('remodal')].open();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment