Files
odoo_source/addons/portal/controllers/web.py
T
Florian Charlier b5f3433adc [IMP] auth_signup,portal,web: welcome external users w/o portal
When portal is not installed and `auth_signup.invitation_scope` is "b2c",
visitors can create an account, leading to a blank page. Still, accounts can be
required for several use cases in apps that do not require portal (such as
survey).

We here add a landing page for users that created an account but have no
requested redirections and cannot be redirected to a customer portal either.

auth_signup_uninvited is also updated in model to be consistent with config
data.

Tests are added to check this behavior.

Task-2762102

Part-of: odoo/odoo#85703
2022-06-14 09:35:57 +02:00

28 lines
1007 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http
from odoo.addons.web.controllers.home import Home as WebHome
from odoo.addons.web.controllers.utils import is_user_internal
from odoo.http import request
class Home(WebHome):
@http.route()
def index(self, *args, **kw):
if request.session.uid and not is_user_internal(request.session.uid):
return request.redirect_query('/my', query=request.params)
return super().index(*args, **kw)
def _login_redirect(self, uid, redirect=None):
if not redirect and not is_user_internal(uid):
redirect = '/my'
return super()._login_redirect(uid, redirect=redirect)
@http.route()
def web_client(self, s_action=None, **kw):
if request.session.uid and not is_user_internal(request.session.uid):
return request.redirect_query('/my', query=request.params)
return super().web_client(s_action, **kw)