Merge lp:~widelands-dev/widelands-website/cookies into lp:widelands-website

Proposed by kaputtnik
Status: Merged
Merged at revision: 501
Proposed branch: lp:~widelands-dev/widelands-website/cookies
Merge into: lp:widelands-website
Diff against target: 45 lines (+12/-1)
3 files modified
local_settings.py.sample (+1/-0)
pybb/util.py (+4/-1)
settings.py (+7/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands-website/cookies
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+355939@code.launchpad.net

Commit message

Use a session based csrf cookie; Fixed showing deleted username when quoting a post

Description of the change

Follow up from the deleted_user branch: When quoting a forum post the real username, instead of DELETED_USERNAME, was shown. This branch fixes this.

Use a session based csrf cookie, which means it will be deleted after closing the browser. I have tested several other cookie settings but i think this is the best for our needs.

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

LGTM :)

review: Approve
Revision history for this message
kaputtnik (franku) wrote :

Merged and deployed.

Thanks for the review :-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'local_settings.py.sample'
2--- local_settings.py.sample 2018-05-12 14:01:09 +0000
3+++ local_settings.py.sample 2018-10-01 17:22:13 +0000
4@@ -13,6 +13,7 @@
5 STATIC_MEDIA_PATH = os.path.join(bd, 'media')
6 MEDIA_ROOT = os.path.join(bd, 'media/')
7
8+
9 # If you are using the developer version of widelands from Launchpad
10 # set WIDELANDS_SVN_DIR to the correct path. See also:
11 # https://wl.widelands.org/wiki/BzrPrimer/
12
13=== modified file 'pybb/util.py'
14--- pybb/util.py 2018-04-03 05:18:03 +0000
15+++ pybb/util.py 2018-10-01 17:22:13 +0000
16@@ -170,7 +170,10 @@
17
18 def quote_text(text, user, markup):
19 """Quote message using selected markup."""
20- text = '*' + user.username + ' wrote:*\n\n' + text
21+
22+ quoted_username = settings.DELETED_USERNAME if user.wlprofile.deleted else user.username
23+
24+ text = '*' + quoted_username + ' wrote:*\n\n' + text
25
26 if markup == 'markdown':
27 # Inserting a space after ">" will not change the generated HTML,
28
29=== modified file 'settings.py'
30--- settings.py 2018-09-19 18:08:39 +0000
31+++ settings.py 2018-10-01 17:22:13 +0000
32@@ -330,6 +330,13 @@
33 DELETED_MAIL_ADDRESS = ''
34 DELETED_USERNAME = 'Ex-Member'
35
36+###################
37+# Cookie settings #
38+###################
39+
40+# See: https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-age
41+CSRF_COOKIE_AGE = None
42+
43 try:
44 from local_settings import *
45 except ImportError:

Subscribers

People subscribed via source and target branches