Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same messages for not found and access denied #1812

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/moin/apps/frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,11 @@ def ajaxdestroy(item_name, req="destroy"):
if isinstance(item, NonExistent):
# we should not try to destroy a nonexistent item,
# user probably checked a subitem and checked do subitems
response["messages"].append(_("Item '{bad_name}' does not exist.").format(bad_name=item.name))
response["messages"].append(
_("Item '{bad_name}' does not exist or you do not have permission to access it.").format(
bad_name=item.name
)
)
continue
subitem_names = []
if req == "destroy":
Expand Down
2 changes: 1 addition & 1 deletion src/moin/templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1> {{ _("Not Found") }}</h1>
<div class="error">
<p>
<strong>
{{ _("The item '{item_name}' does not exist.").format(item_name=item_name) }}
{{ _("The item '{item_name}' does not exist or you do not have permission to access it.").format(item_name=item_name) }}
</strong>
</p>
{% if path %}
Expand Down
4 changes: 2 additions & 2 deletions src/moin/templates/show_nonexistent.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends theme("layout.html") %}
{% block content %}
<h1>{{ _("Item not found") }}</h1>
<h1>{{ _("Item not found or access denied") }}</h1>
<p>
{{ _("Item '{name}' does not exist.").format(name=item_name) }}
{{ _("Item '{name}' does not exist or you do not have permission to access it.").format(name=item_name) }}
</p>
{% endblock %}
6 changes: 4 additions & 2 deletions src/moin/themes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ def render_template(template, **context):
def themed_error(e):
item_name = request.view_args.get("item_name", "")
if e.code == 403:
title = L_("Access Denied")
description = L_("You are not allowed to access this resource.")
title = L_("Item not found or access denied")
description = L_("Item '{name}' does not exist or you do not have permission to access it.").format(
name=item_name
)
if e.description.startswith(" "):
# leading blank indicates supplemental info, not standard werkzeug message
description += e.description
Expand Down
Loading