[FIX] website: avoid redirect to website after login

When logged in a user was redirected to the website instead of the backend.
This was due to a wrong group verification, at that point:
- request.uid = ID of the user authenticating (e.g. admin)
- request.env.uid = ID of the user that rendered the page (public)

As public does not belong to `base.group_user` group, the user was redirected to
the website.

Introduced at fd09ddb6 during migration.

Fixes #13203
Closes #13204
This commit is contained in:
Aristobulo Meneses
2016-08-19 17:16:30 +02:00
committed by Martin Trigaux
parent 5c3a60eb50
commit 814eae1fbd
+1 -1
View File
@@ -82,7 +82,7 @@ class Website(Home):
def web_login(self, redirect=None, *args, **kw):
response = super(Website, self).web_login(redirect=redirect, *args, **kw)
if not redirect and request.params['login_success']:
if request.env.user.has_group('base.group_user'):
if request.env['res.users'].browse(request.uid).has_group('base.group_user'):
redirect = '/web?' + request.httprequest.query_string
else:
redirect = '/'