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
=== modified file 'local_settings.py.sample'
--- local_settings.py.sample 2018-05-12 14:01:09 +0000
+++ local_settings.py.sample 2018-10-01 17:22:13 +0000
@@ -13,6 +13,7 @@
13STATIC_MEDIA_PATH = os.path.join(bd, 'media')13STATIC_MEDIA_PATH = os.path.join(bd, 'media')
14MEDIA_ROOT = os.path.join(bd, 'media/')14MEDIA_ROOT = os.path.join(bd, 'media/')
1515
16
16# If you are using the developer version of widelands from Launchpad17# If you are using the developer version of widelands from Launchpad
17# set WIDELANDS_SVN_DIR to the correct path. See also:18# set WIDELANDS_SVN_DIR to the correct path. See also:
18# https://wl.widelands.org/wiki/BzrPrimer/19# https://wl.widelands.org/wiki/BzrPrimer/
1920
=== modified file 'pybb/util.py'
--- pybb/util.py 2018-04-03 05:18:03 +0000
+++ pybb/util.py 2018-10-01 17:22:13 +0000
@@ -170,7 +170,10 @@
170170
171def quote_text(text, user, markup):171def quote_text(text, user, markup):
172 """Quote message using selected markup."""172 """Quote message using selected markup."""
173 text = '*' + user.username + ' wrote:*\n\n' + text173
174 quoted_username = settings.DELETED_USERNAME if user.wlprofile.deleted else user.username
175
176 text = '*' + quoted_username + ' wrote:*\n\n' + text
174177
175 if markup == 'markdown':178 if markup == 'markdown':
176 # Inserting a space after ">" will not change the generated HTML,179 # Inserting a space after ">" will not change the generated HTML,
177180
=== modified file 'settings.py'
--- settings.py 2018-09-19 18:08:39 +0000
+++ settings.py 2018-10-01 17:22:13 +0000
@@ -330,6 +330,13 @@
330DELETED_MAIL_ADDRESS = ''330DELETED_MAIL_ADDRESS = ''
331DELETED_USERNAME = 'Ex-Member'331DELETED_USERNAME = 'Ex-Member'
332332
333###################
334# Cookie settings #
335###################
336
337# See: https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-age
338CSRF_COOKIE_AGE = None
339
333try:340try:
334 from local_settings import *341 from local_settings import *
335except ImportError:342except ImportError:

Subscribers

People subscribed via source and target branches