diff --git a/CHANGELOG.md b/CHANGELOG.md index ccbd387b..3f3a2dd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,13 @@ 1. [](#new) * IMPORTANT: Non `admin.super` users are now subject to XSS validation in Page content. Configurable via Configuration / Security * Added new event `onAdminPage` which allows plugins to customize `Page` object in `$event['page']` + * Added proper support for hiding form fields in blueprints by using dynamic property like `security@: admin.foobar` to any field 1. [](#improved) * Use `Url:post()` to get the `$_POST` variable (allows common security checks/filtering for the POST data) 1. [](#bugfix) * Fixed issue in filepicker where missing images would cause a loop to try to load them + * Make all form fields to extend field.html.twig + * Do not redirect to `/admin` for login if admin page does not exist # v1.8.9 ## 08/23/2018 diff --git a/admin.php b/admin.php index 6e1b2191..b7bfa6be 100644 --- a/admin.php +++ b/admin.php @@ -434,7 +434,13 @@ class AdminPlugin extends Plugin throw new \RuntimeException('Page Not Found', 404); } } else { - $this->grav->redirect($this->admin_route); + // Not Found and not logged in: Display login page. + $login_file = $this->grav['locator']->findResource('plugins://admin/pages/admin/login.md'); + $page = new Page(); + $page->init(new \SplFileInfo($login_file)); + $page->slug(basename($this->route)); + unset($this->grav['page']); + $this->grav['page'] = $page; } } diff --git a/languages/en.yaml b/languages/en.yaml index 4b06c210..e552d8a5 100644 --- a/languages/en.yaml +++ b/languages/en.yaml @@ -532,7 +532,6 @@ PLUGIN_ADMIN: ADD_FOLDER: "Add Folder" PROXY_URL: "Proxy URL" PROXY_URL_HELP: "Enter the proxy HOST or IP and PORT" - INVALID_FRONTMATTER_COULD_NOT_SAVE: "Invalid frontmatter, could not save" 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" @@ -584,7 +583,6 @@ PLUGIN_ADMIN: CANNOT_ADD_FILES_PAGE_NOT_SAVED: "NOTE: Page must be saved before you can upload files to it." DROP_FILES_HERE_TO_UPLOAD: "Drop your files here or click in this area" INSERT: "Insert" - METADATA: "Metadata" UNDO: "Undo" REDO: "Redo" HEADERS: "Headers" diff --git a/themes/grav/templates/forms/field.html.twig b/themes/grav/templates/forms/field.html.twig index 526f7789..b8985c32 100644 --- a/themes/grav/templates/forms/field.html.twig +++ b/themes/grav/templates/forms/field.html.twig @@ -1,3 +1,5 @@ +{% if not field.validate.ignore %} + {% set originalValue = originalValue is defined ? originalValue : value %} {% set toggleableChecked = field.toggleable and (originalValue is not null and originalValue is not empty) %} {% set isDisabledToggleable = field.toggleable and not toggleableChecked %} @@ -106,3 +108,5 @@ {% endblock %} {% endblock %} + +{% endif %} \ No newline at end of file diff --git a/themes/grav/templates/forms/fields/blueprint/blueprint.html.twig b/themes/grav/templates/forms/fields/blueprint/blueprint.html.twig index f588feb4..e4d07ffa 100644 --- a/themes/grav/templates/forms/fields/blueprint/blueprint.html.twig +++ b/themes/grav/templates/forms/fields/blueprint/blueprint.html.twig @@ -1,3 +1,6 @@ +{% extends "forms/field.html.twig" %} + +{% block field %} +{% endblock %} \ No newline at end of file diff --git a/themes/grav/templates/forms/fields/column/column.html.twig b/themes/grav/templates/forms/fields/column/column.html.twig index 3b699d84..f244ecf1 100644 --- a/themes/grav/templates/forms/fields/column/column.html.twig +++ b/themes/grav/templates/forms/fields/column/column.html.twig @@ -1,10 +1,14 @@ +{% extends "forms/field.html.twig" %} + +{% block field %} {% if field.fields %}