Skip to content

Commit 2e50942

Browse files
committed
merge heads
2 parents 44d59f7 + cd9e381 commit 2e50942

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

CHANGES.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Features:
2929
user.search.hml). Incorporate user search features from
3030
issues.roundup-tracker.org into classic template. Devel and
3131
responsive templates already have this feature.
32-
32+
- issue2550917 - Add a: "Welcome user, you have logged in" ok_message
33+
on login. (Ashley Burke)
3334

3435
2021-07-13 2.1.0
3536

roundup/cgi/actions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,14 @@ def handle(self):
13541354

13551355
# If we came from someplace, go back there
13561356
if '__came_from' in self.form:
1357+
query['@ok_message'] = _("Welcome %(username)s!") %{"username" : self.client.user, } # adds welcome message to user when logged in
1358+
redirect_url = urllib_.urlunparse((redirect_url_tuple.scheme,
1359+
redirect_url_tuple.netloc,
1360+
redirect_url_tuple.path,
1361+
redirect_url_tuple.params,
1362+
urllib_.urlencode(list(sorted(query.items())), doseq=True),
1363+
redirect_url_tuple.fragment))
1364+
13571365
raise exceptions.Redirect(redirect_url)
13581366

13591367
def verifyLogin(self, username, password):

test/test_actions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,22 +368,22 @@ def opendb(username):
368368
self.client.opendb = opendb
369369

370370
# basic test with query
371-
self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search",
371+
self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search&%40ok_message=Welcome+foo%21",
372372
'foo', 'right', "http://whoami.com/path/issue?@action=search")
373373

374374
# test that old messages are removed
375375
self.form.value[:] = [] # clear out last test's setup values
376-
self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search",
376+
self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search&%40ok_message=Welcome+foo%21",
377377
'foo', 'right', "http://whoami.com/path/issue?@action=search&@ok_messagehurrah+we+win&@error_message=blam")
378378

379379
# test when there is no query
380380
self.form.value[:] = [] # clear out last test's setup values
381-
self.assertLoginRaisesRedirect("http://whoami.com/path/issue255",
381+
self.assertLoginRaisesRedirect("http://whoami.com/path/issue255?%40ok_message=Welcome+foo%21",
382382
'foo', 'right', "http://whoami.com/path/issue255")
383383

384384
# test if we are logged out; should kill the @action=logout
385385
self.form.value[:] = [] # clear out last test's setup values
386-
self.assertLoginRaisesRedirect("http://whoami.com/path/issue39?%40pagesize=50&%40startwith=0",
386+
self.assertLoginRaisesRedirect("http://whoami.com/path/issue39?%40ok_message=Welcome+foo%21&%40pagesize=50&%40startwith=0",
387387
'foo', 'right', "http://whoami.com/path/issue39?@action=logout&@pagesize=50&@startwith=0")
388388

389389
def testInvalidLoginRedirect(self):

0 commit comments

Comments
 (0)