From 438e198e5311120ccb83782cc2e14b21f477203c Mon Sep 17 00:00:00 2001 From: mdipierro Date: Wed, 7 Aug 2013 07:04:05 -0500 Subject: [PATCH] no more self.next in Auth, thanks Niphlod --- VERSION | 2 +- gluon/tools.py | 34 +++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/VERSION b/VERSION index 53af642c..569f6b1c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.08.07.04.13.27 +Version 2.6.0-development+timestamp.2013.08.07.07.03.01 diff --git a/gluon/tools.py b/gluon/tools.py index 2533a25e..1f98e6af 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -1154,9 +1154,6 @@ class Auth(object): del session.auth # ## what happens after login? - self.next = current.request.vars._next - if isinstance(self.next, (list, tuple)): - self.next = self.next[0] url_index = URL(controller, 'index') url_login = URL(controller, function, args='login') # ## what happens after registration? @@ -1235,6 +1232,12 @@ class Auth(object): else: self.signature = None + def get_vars_next(self): + next = current.request.vars._next + if isinstance(next, (list, tuple)): + next = next[0] + return next + def _get_user_id(self): "accessor for auth.user_id" return self.user and self.user.id or None @@ -2038,17 +2041,18 @@ class Auth(object): except: pass - ### use session for federated login - if self.next: - session._auth_next = self.next + ### use session for federated login + snext = self.get_vars_next() + if snext: + session._auth_next = snext elif session._auth_next: - self.next = session._auth_next + snext = session._auth_next ### pass if next is DEFAULT: # important for security next = self.settings.login_next - user_next = self.next + user_next = snext if user_next: external = user_next.split('://') if external[0].lower() in ['http', 'https', 'ftp']: @@ -2292,7 +2296,7 @@ class Auth(object): redirect(self.settings.logged_url, client_side=self.settings.client_side) if next is DEFAULT: - next = self.next or self.settings.register_next + next = self.get_vars_next() or self.settings.register_next if onvalidation is DEFAULT: onvalidation = self.settings.register_onvalidation if onaccept is DEFAULT: @@ -2487,7 +2491,7 @@ class Auth(object): response.flash = self.messages.function_disabled return '' if next is DEFAULT: - next = self.next or self.settings.retrieve_username_next + next = self.get_vars_next() or self.settings.retrieve_username_next if onvalidation is DEFAULT: onvalidation = self.settings.retrieve_username_onvalidation if onaccept is DEFAULT: @@ -2569,7 +2573,7 @@ class Auth(object): response.flash = self.messages.function_disabled return '' if next is DEFAULT: - next = self.next or self.settings.retrieve_password_next + next = self.get_vars_next() or self.settings.retrieve_password_next if onvalidation is DEFAULT: onvalidation = self.settings.retrieve_password_onvalidation if onaccept is DEFAULT: @@ -2645,7 +2649,7 @@ class Auth(object): session = current.session if next is DEFAULT: - next = self.next or self.settings.reset_password_next + next = self.get_vars_next() or self.settings.reset_password_next try: key = request.vars.key or getarg(-1) t0 = int(key.split('-')[0]) @@ -2706,7 +2710,7 @@ class Auth(object): (self.settings.retrieve_password_captcha != False and self.settings.captcha) if next is DEFAULT: - next = self.next or self.settings.request_reset_password_next + next = self.get_vars_next() or self.settings.request_reset_password_next if not self.settings.mailer: response.flash = self.messages.function_disabled return '' @@ -2809,7 +2813,7 @@ class Auth(object): request = current.request session = current.session if next is DEFAULT: - next = self.next or self.settings.change_password_next + next = self.get_vars_next() or self.settings.change_password_next if onvalidation is DEFAULT: onvalidation = self.settings.change_password_onvalidation if onaccept is DEFAULT: @@ -2878,7 +2882,7 @@ class Auth(object): request = current.request session = current.session if next is DEFAULT: - next = self.next or self.settings.profile_next + next = self.get_vars_next() or self.settings.profile_next if onvalidation is DEFAULT: onvalidation = self.settings.profile_onvalidation if onaccept is DEFAULT: