Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2971)

Unified Diff: appengine/findit/common/base_handler.py

Issue 2537143003: [Findit] Redirect to original page after login for triage. (Closed)
Patch Set: Fix test failures & rename var. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/findit/common/test/base_handler_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/common/base_handler.py
diff --git a/appengine/findit/common/base_handler.py b/appengine/findit/common/base_handler.py
index 7baba606a9279409435b8c840aa56c93e9ee06cb..c70b8d6c055d48eac9f22d3498949f3f3560ccc5 100644
--- a/appengine/findit/common/base_handler.py
+++ b/appengine/findit/common/base_handler.py
@@ -38,6 +38,9 @@ class BaseHandler(webapp2.RequestHandler):
# Subclass needs to overwrite it explicitly to give wider access.
PERMISSION_LEVEL = Permission.ADMIN
+ # By default, redirect to destination page after login for GET requests.
+ LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET = True
+
def _HasPermission(self):
if (self.request.headers.get('X-AppEngine-QueueName') or
self.request.headers.get('X-AppEngine-Cron')):
@@ -152,12 +155,13 @@ class BaseHandler(webapp2.RequestHandler):
def GetLoginUrl(self):
"""Returns the login url."""
- if self.request.method == 'GET':
- # For GET, all parameters are included in the URL.
+ # For GET, all parameters are included in the URL. So it is safe to redirect
+ # to the destination page. However, for POST, the parameters could be in the
+ # body and include files, so it is better to redirect to the original page.
+ if (self.request.method == 'GET' and
+ self.LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET):
return users.create_login_url(self.request.url)
else:
- # For others like POST, the parameters could be in the body and include
- # file, etc. Thus return to the original page if available.
return users.create_login_url(self.request.referrer)
def _Handle(self, handler_func):
« no previous file with comments | « no previous file | appengine/findit/common/test/base_handler_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698