Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
3 Antworten
6005 Ansichten

Hi,

When i tried to override the web_login function in the web module, it generates some issues.

I just override the function like this, no changes is made into the code, just copy and paste the function into custom module with necessary changes.

The function is this,

from odoo.addons.web.controllers import main

class Home(main.Home):

@http.route('/web/login', type='http', auth="none")
def web_login(self, redirect=None, **kw):
main.ensure_db()
request.params['login_success'] = False
if request.httprequest.method == 'GET' and redirect and request.session.uid:
return http.redirect_with_hash(redirect)
    #.... ...
    #...........

On overriding the function like this, there it generated alignment issue in the login page '/web/login'
An extra padding get added in the top of the page, also it shows the Administrator name(the name which shows after logged into the db) even without logged in. What is the reason ?

And there is no such problem/issues when auth is given as public

@http.route('/web/login', type='http', auth="public")
def web_login(self, redirect=None, **kw):

Why such an issue on giving auth="none", in the original file also it is auth="none".

Thanks

Avatar
Verwerfen

Checkout Template changes. Did you changed templates?

Autor

Nothing done with the template

Autor Beste Antwort

It Seems that the function is already overrided in the website module with the auth as public.

@http.route(website=True, auth="public")
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['res.users'].browse(request.uid).has_group('base.group_user'):
redirect = '/web?' + request.httprequest.query_string
else:
redirect = '/'
return http.redirect_with_hash(redirect)
return response
Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
5
Feb. 24
24152
0
Juli 18
2636
2
Juli 18
3036
2
Nov. 17
4530
0
Juni 25
2334