add CSRF protection

This commit is contained in:
wiktr committed 2026-08-28 14:48:58 +02:00
1 parent 8b94f36db5
commit 37442c9864
5 files changed
+197 -121

No files matched your search

+16 -9
View File
@@ -4,7 +4,11 @@
<title>Dashboard - IZBI DNS</title>
</head>
<body>
<h2>Hello {{ username }} <a href="/logout">log&nbsp;out</a></h2>
<h2>Hello {{ username }}</h2>
<form method="POST" action="/logout">
{{ logout_form.hidden_tag() }}
<button type="submit">Log&nbsp;Out</button>
</form>
{% with messages = get_flashed_messages()%}
{% if messages%}
@@ -23,14 +27,16 @@
<p>Your tokens:
<form method="POST" action="/generate-token">
<input type="text" name="token" placeholder="token name" />
<button type="submit">new&nbsp;token</button>
{{ generate_token_form.hidden_tag() }}
{{ generate_token_form.token_name(placeholder="Token Name") }}
<button type="submit">New&nbsp;Token</button>
</form>
<ul>{% for token in tokens %}
<li>
<form method="POST" action="/revoke-token">
<input type="text" name="token" readonly value="{{ token }}" />
<button type="submit">revoke</button>
{{ revoke_token_form.hidden_tag() }}
{{ revoke_token_form.token_name(placeholder="Token Name", readonly=True, value=token) }}
<button type="submit">Revoke</button>
</form>
</li>
{% endfor %}
@@ -39,10 +45,11 @@
<p>Password change
<form method="POST" action="/change-password">
<input type="password" name="pass" placeholder="old password" /><br />
<input type="password" name="pass-new" placeholder="new password" /><br />
<input type="password" name="pass-rep" placeholder="repeat password" /><br />
<button type="submit">change password</button>
{{ change_password_form.hidden_tag() }}
{{ change_password_form.password(placeholder="Old Password") }}<br />
{{ change_password_form.new_password(placeholder="New Password") }}<br />
{{ change_password_form.repeat_password(placeholder="Repeat Password") }}<br />
<button type="submit">Change Password</button>
</form>
</p>{% if is_admin %}{% include 'admin.html' %}{% endif %}
</body>