changeset 6471:c1053be84fa7

merge heads
author John Rouillard <rouilj@ieee.org>
date Sat, 21 Aug 2021 20:26:09 -0400
parents 60532cafc62a (current diff) 37b57da3374f (diff)
children 47a521b9ebb9
files
diffstat 3 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Sat Aug 21 20:24:09 2021 -0400
+++ b/CHANGES.txt	Sat Aug 21 20:26:09 2021 -0400
@@ -29,7 +29,8 @@
   user.search.hml). Incorporate user search features from
   issues.roundup-tracker.org into classic template. Devel and
   responsive templates already have this feature.
-  
+- issue2550917 - Add a: "Welcome user, you have logged in" ok_message
+  on login. (Ashley Burke)
 
 2021-07-13 2.1.0
 
--- a/roundup/cgi/actions.py	Sat Aug 21 20:24:09 2021 -0400
+++ b/roundup/cgi/actions.py	Sat Aug 21 20:26:09 2021 -0400
@@ -1354,6 +1354,14 @@
 
         # If we came from someplace, go back there
         if '__came_from' in self.form:
+            query['@ok_message'] = _("Welcome %(username)s!") %{"username" : self.client.user, }       # adds welcome message to user when logged in
+            redirect_url = urllib_.urlunparse((redirect_url_tuple.scheme,
+                                               redirect_url_tuple.netloc,
+                                               redirect_url_tuple.path,
+                                               redirect_url_tuple.params,
+                                               urllib_.urlencode(list(sorted(query.items())), doseq=True),
+                                               redirect_url_tuple.fragment))
+
             raise exceptions.Redirect(redirect_url)
 
     def verifyLogin(self, username, password):
--- a/test/test_actions.py	Sat Aug 21 20:24:09 2021 -0400
+++ b/test/test_actions.py	Sat Aug 21 20:26:09 2021 -0400
@@ -368,22 +368,22 @@
         self.client.opendb = opendb
 
         # basic test with query
-        self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search",
+        self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search&%40ok_message=Welcome+foo%21",
                                  'foo', 'right', "http://whoami.com/path/issue?@action=search")
 
         # test that old messages are removed
         self.form.value[:] = []         # clear out last test's setup values
-        self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search",
+        self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search&%40ok_message=Welcome+foo%21",
                                  'foo', 'right', "http://whoami.com/path/issue?@action=search&@ok_messagehurrah+we+win&@error_message=blam")
 
         # test when there is no query
         self.form.value[:] = []         # clear out last test's setup values
-        self.assertLoginRaisesRedirect("http://whoami.com/path/issue255",
+        self.assertLoginRaisesRedirect("http://whoami.com/path/issue255?%40ok_message=Welcome+foo%21",
                                  'foo', 'right', "http://whoami.com/path/issue255")
 
         # test if we are logged out; should kill the @action=logout
         self.form.value[:] = []         # clear out last test's setup values
-        self.assertLoginRaisesRedirect("http://whoami.com/path/issue39?%40pagesize=50&%40startwith=0",
+        self.assertLoginRaisesRedirect("http://whoami.com/path/issue39?%40ok_message=Welcome+foo%21&%40pagesize=50&%40startwith=0",
                                  'foo', 'right', "http://whoami.com/path/issue39?@action=logout&@pagesize=50&@startwith=0")
 
     def testInvalidLoginRedirect(self):

Roundup Issue Tracker: http://roundup-tracker.org/