[FIX] portal, website: login redirection
* migrate website to overriding web_login less (still needed to flag it as website-enabled) and use _login_redirect for its login redirection override needs * modify portal and website to not replace / shortcut the redirection workflow, so it's possible to override those properly if / as necessary
This commit is contained in:
committed by
Olivier Dony
parent
083c70bbb6
commit
9f82605df1
@@ -16,7 +16,7 @@ class Home(Home):
|
||||
|
||||
def _login_redirect(self, uid, redirect=None):
|
||||
if not redirect and not request.env['res.users'].sudo().browse(uid).has_group('base.group_user'):
|
||||
return '/my'
|
||||
redirect = '/my'
|
||||
return super(Home, self)._login_redirect(uid, redirect=redirect)
|
||||
|
||||
@http.route('/web', type='http', auth="none")
|
||||
|
||||
@@ -95,17 +95,20 @@ class Website(Home):
|
||||
# while portal users are redirected to the frontend by default
|
||||
# ------------------------------------------------------
|
||||
|
||||
@http.route(website=True, auth="public", sitemap=False)
|
||||
def web_login(self, redirect=None, *args, **kw):
|
||||
response = super(Website, self).web_login(redirect=redirect, *args, **kw)
|
||||
def _login_redirect(self, uid, redirect=None):
|
||||
""" Redirect regular users (employees) to the backend) and others to
|
||||
the frontend
|
||||
"""
|
||||
if not redirect and request.params['login_success']:
|
||||
if request.env['res.users'].browse(request.uid).has_group('base.group_user'):
|
||||
if request.env['res.users'].browse(uid).has_group('base.group_user'):
|
||||
redirect = b'/web?' + request.httprequest.query_string
|
||||
else:
|
||||
redirect = '/my'
|
||||
return http.redirect_with_hash(redirect)
|
||||
return response
|
||||
return super()._login_redirect(uid, redirect=redirect)
|
||||
|
||||
@http.route(website=True, auth="public", sitemap=False)
|
||||
def web_login(self, *args, **kw):
|
||||
return super().web_login(*args, **kw)
|
||||
# ------------------------------------------------------
|
||||
# Business
|
||||
# ------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user