add csrf token to forms #2

This commit is contained in:
Yusur 2022-11-10 21:54:48 +01:00
parent 891fe36a83
commit d45d5c4284
2 changed files with 3 additions and 0 deletions

2
app.py
View file

@ -189,6 +189,8 @@ class Page(BaseModel):
@property @property
def prop(self): def prop(self):
return PagePropertyDict(self) return PagePropertyDict(self)
def is_editable(self):
return not self.is_locked
class PageText(BaseModel): class PageText(BaseModel):

View file

@ -32,6 +32,7 @@
{% endif %} {% endif %}
<form method="POST"> <form method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<div> <div>
<label for="title"><span class="material-icons">link</span> /</label> <label for="title"><span class="material-icons">link</span> /</label>
<input type="text" name="url" class="url-input" placeholder="(No URL)" maxlength="64" value="{{ pl_url or '' }}"> <input type="text" name="url" class="url-input" placeholder="(No URL)" maxlength="64" value="{{ pl_url or '' }}">