Skip to content

Commit

Permalink
Merge pull request #28 from rcthomas/add-xsrf
Browse files Browse the repository at this point in the history
Add xsrf
  • Loading branch information
rcthomas authored Jun 5, 2024
2 parents 8393df3 + 2846031 commit 7107986
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions jupyterhub_announcement/announcement.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def initialize(self, argv=None):
"static_path": os.path.join(self.data_files_path, "static"),
"static_url_prefix": url_path_join(self.service_prefix, "static/"),
"log": self.log,
"xsrf_cookies": True,
}

self.app = web.Application(
Expand Down
1 change: 1 addition & 0 deletions jupyterhub_announcement/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def get(self):
base_url=prefix,
no_spawner_check=True,
parsed_scopes=user.get("hub_scopes") or [],
xsrf_form_html=self.xsrf_form_html,
)
)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
name="jupyterhub-announcement",
packages=["jupyterhub_announcement"],
url="https://github.com/rcthomas/jupyterhub-announcement",
version="1.0.0.dev",
version="0.9.2.dev",
)
1 change: 1 addition & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
{% if user.admin %}
<div class="row">
<form action="/services/announcement/update" method="post" class="col-md-offset-3 col-md-6">
{{ xsrf_form_html() | safe }}
<div class="form-group">
<label for="announcement">Announcement</label>
<textarea class="form-control" id="announcement" name="announcement" rows="2" placeholder="Announcement text..."></textarea>
Expand Down

0 comments on commit 7107986

Please sign in to comment.