Skip to content
Snippets Groups Projects
Commit b08301e5 authored by Olivier Dony's avatar Olivier Dony
Browse files

[FIX] web: expect explicit sign up parameters

Using an explicit list of sign up parameters will avoid
polluting the context with unrelated values, and make
debugging easier.
parent 384d67b9
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ import werkzeug
from odoo import http, _
from odoo.addons.auth_signup.models.res_users import SignupError
from odoo.addons.web.controllers.main import ensure_db, Home
from odoo.addons.web.controllers.main import ensure_db, Home, SIGN_UP_REQUEST_PARAMS
from odoo.addons.base_setup.controllers.main import BaseSetup
from odoo.exceptions import UserError
from odoo.http import request
......@@ -104,7 +104,7 @@ class AuthSignupHome(Home):
def get_auth_signup_qcontext(self):
""" Shared helper returning the rendering context for signup and reset password """
qcontext = request.params.copy()
qcontext = {k: v for (k, v) in request.params.items() if k in SIGN_UP_REQUEST_PARAMS}
qcontext.update(self.get_auth_signup_config())
if not qcontext.get('token') and request.session.get('auth_signup_token'):
qcontext['token'] = request.session.get('auth_signup_token')
......
......@@ -607,6 +607,10 @@ class HomeStaticTemplateHelpers(object):
def get_qweb_templates(cls, addons, db=None, debug=False):
return cls(addons, db, debug=debug)._get_qweb_templates()[0]
# Shared parameters for all login/signup flows
SIGN_UP_REQUEST_PARAMS = {'db', 'login', 'debug', 'token', 'message', 'error', 'scope', 'mode',
'redirect', 'redirect_hostname', 'email', 'name', 'partner_id',
'password', 'confirm_password', 'city', 'country_id', 'lang'}
class GroupsTreeNode:
"""
......@@ -899,7 +903,7 @@ class Home(http.Controller):
if not request.uid:
request.uid = odoo.SUPERUSER_ID
values = request.params.copy()
values = {k: v for k, v in request.params.items() if k in SIGN_UP_REQUEST_PARAMS}
try:
values['databases'] = http.db_list()
except odoo.exceptions.AccessDenied:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment