diff options
| author | Christophe Simonis <chs@openerp.com> | 2014-03-24 14:38:11 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@openerp.com> | 2014-03-24 14:38:11 +0100 |
| commit | d93b79e6f4e5c6c2fda65fbf88df8e1851b6fa4d (patch) | |
| tree | f855bc221056bf09cd4713d6cd44ab6b1449a268 /addons/auth_signup | |
| parent | 7c4557add24726f34fec3aa834c34fa5c9b1f17f (diff) | |
| parent | f4b1d23cf2b44521456b479c1038e17d5ee0bac8 (diff) | |
[MERGE] forward port of branch saas-3 up to revid 9345 dle@openerp.com-20140324110349-e82t1bmmtjqbl85k
bzr revid: chs@openerp.com-20140324133811-4az1kvbznd26seow
Diffstat (limited to 'addons/auth_signup')
| -rw-r--r-- | addons/auth_signup/controllers/main.py | 3 | ||||
| -rw-r--r-- | addons/auth_signup/res_users.py | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index 78f2833f3d1..8a66d3ab075 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -37,6 +37,9 @@ class AuthSignupHome(openerp.addons.web.controllers.main.Home): ensure_db() response = super(AuthSignupHome, self).web_login(*args, **kw) response.qcontext.update(self.get_auth_signup_config()) + if request.httprequest.method == 'GET' and request.session.uid and request.params.get('redirect'): + # Redirect if already logged in and redirect param is present + return http.redirect_with_hash(request.params.get('redirect')) return response @http.route('/web/signup', type='http', auth='public', website=True, multilang=True) diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index 4c1c1a671b7..5a744c21c81 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -20,8 +20,8 @@ ############################################################################## from datetime import datetime, timedelta import random -from urllib import urlencode from urlparse import urljoin +import werkzeug from openerp.addons.base.ir.ir_mail_server import MailDeliveryException from openerp.osv import osv, fields @@ -53,7 +53,7 @@ class res_partner(osv.Model): (not partner.signup_expiration or dt <= partner.signup_expiration) return res - def _get_signup_url_for_action(self, cr, uid, ids, action='login', view_type=None, menu_id=None, res_id=None, model=None, context=None): + def _get_signup_url_for_action(self, cr, uid, ids, action=None, view_type=None, menu_id=None, res_id=None, model=None, context=None): """ generate a signup url for the given partner ids and action, possibly overriding the url state components (menu_id, id, view_type) """ if context is None: @@ -81,6 +81,8 @@ class res_partner(osv.Model): continue # no signup token, no user, thus no signup url! fragment = dict() + if action: + fragment['action'] = action if view_type: fragment['view_type'] = view_type if menu_id: @@ -90,7 +92,10 @@ class res_partner(osv.Model): if res_id: fragment['id'] = res_id - res[partner.id] = urljoin(base_url, "/web/%s?%s#%s" % (route, urlencode(query), urlencode(fragment))) + if fragment: + query['redirect'] = '/web#' + werkzeug.url_encode(fragment) + + res[partner.id] = urljoin(base_url, "/web/%s?%s" % (route, werkzeug.url_encode(query))) return res |
