CSRF Protection (#235)

* Fix alert class name

* feature: csrf protection

* Cosmetics

* Fix token generate

* Admin Panel: changelogs csrf protection

* news/id route

* Refactor admin newses + add csrf

* Use admin.links instead

* Admin panel: Pages csrf

* Menus: better csrf + add success message on reset colors

* Plugins csrf

* Move definitions

* add info function, same as note($message)

* Update mailer.php

* Fix new page/news links

* clear_cache & maintenance csrf

* Formatting

* Fix news type

* Fix changelog link

* Add new changelog link

* More info to confirm dialog

* This is always true
This commit is contained in:
Slawomir Boczek
2023-11-11 10:57:57 +01:00
committed by GitHub
parent a04fbde607
commit 790d85a88a
89 changed files with 789 additions and 504 deletions

View File

@@ -142,6 +142,7 @@
<td>
{% set playerName = player.getName() %}
<form action="?subtopic=guilds&action=change_nick&name={{ playerName }}&guild={{ guild_name }}" method="post">
{{ csrf() }}
{{ getPlayerLink(playerName, true)|raw }}
{% set showGuildNick = false %}
@@ -290,6 +291,7 @@
<tr>
{% if not logged %}
<form action="?subtopic=accountmanagement&redirect={{ getGuildLink(guild_name|url_encode, false) }}" method="post">
{{ csrf() }}
<td>
{{ include('buttons.login.html.twig') }}
</td>
@@ -297,6 +299,7 @@
{% else %}
{% if show_accept_invite > 0 %}
<form action="?subtopic=guilds&action=accept_invite&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td>
<input type="image" name="Accept Invite" alt="Accept Invite" src="{{ template_path }}/images/global/buttons/sbutton_acceptinvite.png" style="width: 120px; height: 20px;">
</td>
@@ -305,6 +308,7 @@
{% if isVice %}
<form action="?subtopic=guilds&action=invite&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td>
{% set button_name = 'Invite Character' %}
{% set button_image = '_sbutton_invitecharacter' %}
@@ -313,6 +317,7 @@
</form>
<form action="?subtopic=guilds&action=change_rank&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td>
{% set button_name = 'Edit Ranks' %}
{% set button_image = '_sbutton_editranks' %}
@@ -323,6 +328,7 @@
{% if players_from_account_in_guild|length > 0 %}
<form action="?subtopic=guilds&action=leave_guild&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td>
{% set button_name = 'Leave Guild' %}
{% set button_image = '_sbutton_leaveguild' %}
@@ -333,6 +339,7 @@
{% endif %}
<form action="{{ getLink('guilds') }}" method="post">
{{ csrf() }}
<td style="float: right">
{{ include('buttons.back.html.twig') }}
</td>